JavaScript Page Redirect

<script language='JavaScript' type='text/JavaScript'>
<!--
window.location="https://www.google.com";
//-->
</script>
We can redirect users or browser to a different page or url by using JavaScript.

If in browser script execution is disabled then JavaScript (Client side) page redirection won't work. You can check the status of script execution of browser and accordingly warn the users.

You can also redirect by using slef.location like this
self.location='https://www.google.com'

Redirecting after Some time delay

If you are using the above code then the page will redirect to google.com as soon as the page loads to client browser. Here we can delay the process of redirection and show a message. We will be using our timer function to do this. Here is the code.
<html>
<head>
<title>Javascript page redirect</title>
<script language='JavaScript' type='text/JavaScript'>
<!--
setTimeout('window.location="https://www.google.com"',10000)
//-->
</script>
</head>
<body>
You will be reirected to google after 10 Secs 

</body>
</html>
Try to add one count down display to show seconds left for page redirect to work.

Redirecting page based on Selection of Dropdown menu
Window Object Bookmark a page Displaying confirmation window
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    sdaf

    05-07-2010

    Nice tutorial Great.

    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer