redirect javascript
snippet in javascript

redirect javascript

user9775

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

javascript redirect

user603

window.location.href = "http://mywebsite.com/home.html";

javascript redirect

user5995

<script>
  window.location.href = "http://mywebsite.com/home.html";
</script>

redirect with javascript

user2154

window.location.replace('http://mywebsite.com/home.html');

redirect javascript

user9706


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

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

 

redirect javascript

user1446


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

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