ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Redirect with JavaScript?

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> JavaScript / DHTML / HTML / CSS
View previous topic :: View next topic  
Author Message
newbie



Joined: 01 Oct 2004
Posts: 11

PostPosted: Mon Dec 06, 2004 2:00 pm    Post subject: Redirect with JavaScript? Reply with quote

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
View user's profile Send private message
tom



Joined: 03 Dec 2004
Posts: 4

PostPosted: Mon Dec 06, 2004 4:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
raven



Joined: 31 Jan 2006
Posts: 41

PostPosted: Wed Feb 01, 2006 2:02 am    Post subject: Reply with quote

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
View user's profile Send private message
twinkle



Joined: 31 Jan 2006
Posts: 79

PostPosted: Fri Feb 03, 2006 6:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> JavaScript / DHTML / HTML / CSS All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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

SQL Tutorial