1// similar behavior as an HTTP redirect
2window.location.replace("http://stackoverflow.com");
3
4// similar behavior as clicking on a link
5window.location.href = "http://stackoverflow.com";
1<p onclick="myFunction()"></p>
2<script>
3function myFunction() {
4 window.location.href = "https://whereyouwouldliketogo.com"
5}
6</script>
1<html>
2 <head>
3 <script type="text/javascript">
4 function RedirectionJavascript(){
5 document.location.href="http://manouvellepage.com";
6 }
7 </script>
8 </head>
9 <body onLoad="setTimeout('RedirectionJavascript()', 2000)">
10 <div>Dans 2 secondes vous allez être redirigé vers http://manouvellepage.com</div>
11 </body>
12</html>