Redirect to another page ClientSide
-
Hi Friends I am trying to go from one page to another page using Javascript in my aspx page. I am using { window.location.href = link; } My var link has the URL and i did confirm it by using alert. I am getting the correct URL but i want it to go to that page. I think window.location.href is the method for redirecting to another page. Not sure whats wrong. If any of you have any suggestions or help, it would be appreciated. Thanks
Cheers Menon
-
Hi Friends I am trying to go from one page to another page using Javascript in my aspx page. I am using { window.location.href = link; } My var link has the URL and i did confirm it by using alert. I am getting the correct URL but i want it to go to that page. I think window.location.href is the method for redirecting to another page. Not sure whats wrong. If any of you have any suggestions or help, it would be appreciated. Thanks
Cheers Menon
What you have will work in IE, but not Firefox. Someone will no doubt say this is because FF is w3-compliant and IE isn't or some such nonsense, but don't believe them: it's a bug. The fix is twofold: First, add a "return false;" to stop FF posting the page back to itself: window.location.href=link; return false; Second, note that if running this script locally you will need to make your link absolute (http://...) but when running on a live web server a relative link will work. cheers Fred
-
What you have will work in IE, but not Firefox. Someone will no doubt say this is because FF is w3-compliant and IE isn't or some such nonsense, but don't believe them: it's a bug. The fix is twofold: First, add a "return false;" to stop FF posting the page back to itself: window.location.href=link; return false; Second, note that if running this script locally you will need to make your link absolute (http://...) but when running on a live web server a relative link will work. cheers Fred