0

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.

4
Contributors
4
Replies
5
Views
11 Years
Discussion Span
Last Post by Mushy-pea
0

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.

1

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.

Votes + Comments
Very helpfull.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.