944,018 Members | Top Members by Rank

Ad:
Aug 2nd, 2006
0

Redirecting a browser with Javascript....

Expand Post »
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.
Similar Threads
Reputation Points: 47
Solved Threads: 1
Posting Whiz in Training
Mushy-pea is offline Offline
271 posts
since Jun 2006
Aug 2nd, 2006
0

Re: Redirecting a browser with Javascript....

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/";
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Aug 2nd, 2006
0

Re: Redirecting a browser with Javascript....

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.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Aug 3rd, 2006
1

Re: Redirecting a browser with Javascript....

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
Team Colleague
Reputation Points: 92
Solved Threads: 21
Posting Pro in Training
FC Jamison is offline Offline
436 posts
since Jun 2004
Aug 5th, 2006
0

Re: Redirecting a browser with Javascript....

Thanks guys.

Steven.
Reputation Points: 47
Solved Threads: 1
Posting Whiz in Training
Mushy-pea is offline Offline
271 posts
since Jun 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Smart Mind "FLOAT EVERYTHING"
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Null hyperlink: OK?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC