Q:

javascript redirect to

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
window.location.replace('http://mywebsite.com/home.html');
9

  // 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

New to Communities?

Join the community