Javascript Page Redirect

In Javascript redirecting a web page means, taking user to new location. Many website use redirect for many different reasons, e.g. Some website redirect user from old domain to new domain, some redirect from one page to another e.g. a more relevant. In JavaScript, you script a redirect using the same code you use to load a page.

5 ways to redirect URL with Javascript

How to do a redirect to an HTTP POST Request with Javascript? There are different ways to redirect web page from one page to another page or one site to another. Most commanly used ways are described below.

<html>
<head>
<title>Javascript Page Redirect Example</title>
<SCRIPT LANGUAGE="JavaScript">
window.location.href="login.php?backurl="+window.location.href;
</SCRIPT>
</head>
<body>
</body>
</html>
<html>
<head>
<title>Javascript Page Redirect Example</title>
<SCRIPT LANGUAGE="JavaScript">
window.history.back(-1);
</SCRIPT>
</head>
<body>
</body>
</html>
<html>
<head>
<title>Javascript Page Redirect Example</title>
<SCRIPT LANGUAGE="JavaScript">
window.navigate("index.php");
</SCRIPT>
</head>
<body>
</body>
</html>
<html>
<head>
<title>Javascript Page Redirect Example</title>
<SCRIPT LANGUAGE="JavaScript">
self.location="index.php";
</SCRIPT>
</head>
<body>
</body>
</html>
<html>
<head>
<title>Javascript Page Redirect Example</title>
<SCRIPT LANGUAGE="JavaScript">
top.location="error.php";
</SCRIPT>
</head>
<body>
</body>
</html>

See Also

Javascript Built in String Object
Javascript Built in Number Object
Javascript Built in Math Object
Javascript Built in Date Object
Javascript Built in Arrays Object
Javascript Built in Boolean Object
Javascript Built in RegExp Object
Javascript Built in JSON Object


 
SHARE THIS IF YOU LIKE!
submit to reddit
SUBSCRIBE FOR LATEST UPDATES
HAVE WE CONNECTED ON FACEBOOK?
TOP TUTORIALSTOP CODE EXAMPLESTOP LIVE DEMOLINKSSTAY CONNECTED
HTML Tutorial
HTML5 Tutorial
Bootstrap3 Tutorial
Javascript Tutorial
TypeScript Tutorial
AngularJS Tutorial
CSharp Tutorial
PHP Tutorial
Developer Tools
Javascript
AngularJS
Google MAP API V3
ASP.NET
Javascript
AngularJS
Google MAP API V3
Contact Us
Advertise with Us
Privacy Policy
Disclaimer
Stay connected. We actually like you. If you want to get up to the minute updates, then connect with us on your fav below.
 
Twitter   Linkedin   Facebook   Google+    RSS   Pinterest
 
Protected by Copyscape Original Content Checker
 
 
Copyright ©2017 www.techstrikers.com Unauthorized reproduction/replication of any part of this site is prohibited.