Redirecting a browser with Javascript....

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jun 2006
Posts: 263
Reputation: Mushy-pea is an unknown quantity at this point 
Solved Threads: 1
Mushy-pea's Avatar
Mushy-pea Mushy-pea is offline Offline
Posting Whiz in Training

Redirecting a browser with Javascript....

 
0
  #1
Aug 2nd, 2006
Hello everyone. Does anyone know if it is possible to redirect a browser with Javascript? If it is, could someone please give me a clue as to how it is done? I have searched the w3schools tutorial where I started learning Javascript but can't find anything on this. Any help would be appriciated. Thanks.

Steven.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 166
Reputation: Lafinboy is an unknown quantity at this point 
Solved Threads: 7
Lafinboy's Avatar
Lafinboy Lafinboy is offline Offline
Junior Poster

Re: Redirecting a browser with Javascript....

 
0
  #2
Aug 2nd, 2006
A Google for "javascript redirect" would have answered yor question much quicker than posting here.

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. window.location="http://www.yourdomain.com/";
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.

Lafinboy Productions
:: Website Design :: Website Development ::

Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Redirecting a browser with Javascript....

 
0
  #3
Aug 2nd, 2006
There is also the window.replace() method, which takes a string inside the parantheses. The difference between the .replace() method and the .location property, is that .replace() doesn't store the new page in the browser history.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 434
Reputation: FC Jamison is on a distinguished road 
Solved Threads: 20
Team Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Redirecting a browser with Javascript....

 
1
  #4
Aug 3rd, 2006
This code is used specifically to redirect one Web page to another (i.e. if your Web site has moved, put this code at the old location)


<html>
<head>
<title>Redirect JavaScript-browsers</title>

<script language="JavaScript">
<!-- Beginning of JavaScript --------
this.location = "http://www.newsite.com";
// -- End of JavaScript code -------------- -->
</script>

</head>

<body>
This site is now located at <a href="http://www.newsite.com">http://www.newsite.com</a>.
</body>
</html>


I hope that helps you out.
Last edited by FC Jamison; Aug 3rd, 2006 at 6:46 am. Reason: To indicate post as a solution
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 263
Reputation: Mushy-pea is an unknown quantity at this point 
Solved Threads: 1
Mushy-pea's Avatar
Mushy-pea Mushy-pea is offline Offline
Posting Whiz in Training

Re: Redirecting a browser with Javascript....

 
0
  #5
Aug 5th, 2006
Thanks guys.

Steven.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC