JavaScript Redirecting the User to a New PageJavaScript window.location property allows user to reset the location associated with a window and redirect users to a new URL., javascript redirectoften is used in User Registration Form. If you need to send visitors of your site to a different URL automatically, try using JavaScript Redirect. window.location overview (JavaScript Redirect)window.location returns a Location object, which contains information about the URL of the document and provides methods for changing that URL. You can also assign to this property to load another URL.
For Example, <head> <script language=”JavaScript”> window.location = “http://www.devx.biz/”; </script> </head> <body> <p>Hello World</p> </body>
In this page, the text “Hello World” will not display in the browser;as soon as the page loads, the user will immediately be directed to the Devx.biz. javascript redirect form code<form> Enter a URL: <input type="text" name="myurl"> <input type="button" value="Submit" onClick="window.location = this.form.myurl.value"> </form> You can also use the Meta Tag "Refresh" to redirect to a Different URL See below code <html> <head> <meta http-equiv="Refresh" content=6;url="www.devx.biz"> </head> <body> Loading... </body> </html> by changing the number in the refresh content="6 ,you can change the the amount of time that this redirecting page is displayed |