function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sunay - KVP Bus SolnsSunay - KVP Bus Solns 

Back Button functionality of a browser in a visual force page

Hi,

 

We have a application built of Visual force pages and in every page we have a back button. Here I am trying to achieve the functionality of a "Back button in Browser " using only APEX Code.

 

Can anybody suggest some ideas as to how I can add a method to achieve this or is there any different approach which will help me.

Devendra@SFDCDevendra@SFDC

 

The one way of using Back button is calling a apex method on commandButton.

 

<apex:commandButton value="Back" action="{!backMethod}"/>

 

In apex code,

 

public pagereference backMethod()

{

Pagereference pg =  new Pagereference('/apex/NameOfPage); // Include name of page where user should be navigated after clicking on Back button

pg.setRedirect(true);

return pg;

}

 

Hope this helps :)

 

Thanks,

Devendra