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 

how to redirect to a page from javascript

Hi,

 

    Please Let me know how to redirect to a page from javascript. This javascript is being called if any event occurs.

 

I was trying with

 

window.location('/apex/Pagename');

 

But it is not working.

 

Please help me...........

 

Regards,

 

shra1

Best Answer chosen by Admin (Salesforce Developers) 
shra1_devshra1_dev

Hey I got it my self

 

It should be :

 

window.Location="someurl";

All Answers

shra1_devshra1_dev

Hey I got it my self

 

It should be :

 

window.Location="someurl";

This was selected as the best answer
watanabe2watanabe2

is there any way to do this with a controller class and a variable? e.g. location = '/' + recId

Ayan SarkarAyan Sarkar
It shouldn't be 
window.Location="someurl";

Instead
window.Location.href="someurl";