How to use window.location.replace javascript?
- by william
My URLs
http://www.mysite.com/folder1/page1.aspx
http://www.mysite.com/folder1/page1.aspx?id=1
http://www.mysite.com/folder1/page1.aspx?id=1&dt=20111128
Redirecting Page
http://www.mysite.com/folder1/page2.aspx
I want to redirect from page1.aspx to page2.aspx
How to write a javascript in page1.aspx?
window.location.replace("/page2.aspx");
window.location.replace("../page2.aspx");
window.location.replace("~/page2.aspx");
First 2 gave me this.
http://www.mysite.com/page2.aspx
Last 1 gave me this.
http://www.mysite.com/folder1/~/page2.aspx
What is the correct way to use?