eka
0
Q:

javascript redirect function

window.location.href = "http://mywebsite.com/home.html";
34
// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";
8
<script>
  window.location.href = "http://mywebsite.com/home.html";
</script>
12
// Simulate a mouse click:
window.location.href = "http://www.w3schools.com";

// Simulate an HTTP redirect:
window.location.replace("http://www.w3schools.com");
4

  // Simulate 
  a mouse click:
window.location.href = "http://www.w3schools.com";

  
// Simulate an HTTP redirect:
window.location.replace("http://www.w3schools.com");

 
3
window.location.href = "https://your_website.php/page2.php;
// to remove actual address from the history:
window.location.replace = "https://your_website.php/page2.php;
1
<html>
  <head>
    <script type="text/javascript">
      function RedirectionJavascript(){
        document.location.href="http://manouvellepage.com";
      }
   </script>
  </head>
  <body onLoad="setTimeout('RedirectionJavascript()', 2000)">
     <div>Dans 2 secondes vous allez être redirigé vers http://manouvellepage.com</div>
  </body>
</html>
0

New to Communities?

Join the community