View previous topic :: View next topic |
Author |
Message |
newbie
Joined: 01 Oct 2004 Posts: 11
|
Posted: Mon Dec 06, 2004 2:00 pm Post subject: Redirect with JavaScript? |
|
|
I want to redirect to a different page by using client-side JavaScript. What is the best way to redirect with JavaScript?
Thanks _________________ I'm still learning.. |
|
Back to top |
|
|
tom
Joined: 03 Dec 2004 Posts: 4
|
Posted: Mon Dec 06, 2004 4:46 pm Post subject: |
|
|
You can just use document.location = "page_to_redirect_to.html" in Javascript. This will do the redirect on the client-side (in the browser).
Tom |
|
Back to top |
|
|
raven
Joined: 31 Jan 2006 Posts: 41
|
Posted: Wed Feb 01, 2006 2:02 am Post subject: |
|
|
One feature about the location object that may be of interest to you is the ability to replace the current URL with a new one and replace also the history for the current page.
Code: | location.replace(url) |
The replace method loads and displays the new document and overwrites the current entry in the History object. So if you have temporary pages where processing is taking place this protects the user from hitting the browser BACK button and accidentally re-processing a page. It also makes the BACK button more useful. _________________ Programmers do it in code |
|
Back to top |
|
|
twinkle
Joined: 31 Jan 2006 Posts: 79
|
Posted: Fri Feb 03, 2006 6:05 pm Post subject: |
|
|
Out of curiosity, why would you want to do this with javascript. There are so many other ways to do this, what would be the benefit or need to do it with java? _________________ I shine |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|