+ 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";