Q:

js redirect to url

window.location.href = "http://mywebsite.com/home.html";
34
<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
// 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

  // 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.replace('http://mywebsite.com/home.html');
9
window.location = "https://example.com/";
3
window.history.pushState("", "", '/newpage');
0
window.open("http://mywebsite.com/home.html")
0

New to Communities?

Join the community