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
shra1_devshra1_dev 

back button which redirects to previous page

Hi,

 

How to redirect to the previous page from current page(the page which has got by clicking a button/link in the previous page) through javascript.

 

I tried by using window.location(-1) and history.goback(-1). These are not working..

 

I don't want to specify the path of previous page in the action back button/link. Because the same page is used by two different roles and thier previous pages are different.

 

please help me.........

Pradeep_NavatarPradeep_Navatar

Try using the following :

 

1.      Window.history.go(-1)

2.      Window.history.previous()

 

Hope this helps.

shra1_devshra1_dev

Hi Pradeep,

 

Thanks for your reply. Can U explain where I could use these javascript functions.

 

I am using it in the below tag. its not working.

 

<apex:commandlink value="back" onclick="window.history.go(-1)"/>

 

or

 

<apex:commandlink value="back" onclick="window.history.previous()"/>

Anu-SFDCAnu-SFDC

I have the same question which i need to resolve.

 

Please help me..

shra1_devshra1_dev

Could you explain your problem?

 If possible post your code.

 

Regards,

Shravan

Anu-SFDCAnu-SFDC

Hi

 

I put a command button like this

 

  <apex:commandButton value="Back" onclick="window.history.go(-2)"/>

 

This is working perfectly in mozilla firefox now but not working in chrome browser..

 

 

Anu

ve krve kr
Hi.

Once, we click the button, the status field should change to closed and the window needs to be closed automatically.

I have create the custom button and Using below  OnclickJavascript.


{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}

var qr = sforce.connection.query("SELECT Id, Status FROM Case where Id='" + "{!Case.Id}" + "'");
var records = qr.getArray("records");





var o = new sforce.SObject("Case");
o.id = "{!Case.Id}";


o.Status = "Closed";


sforce.connection.update([o]);

window.parent.close();

But the above code working in IE and Chrome but not working in Mozilla.Is there anyway to implementing the above functionality.
Thanks