<body> this is page A <p id="atag">go to the page B!</p > </body> <script> window.onload = function(){ alert("this page is be loaded!"); var open = function(){ setInterval(function(){ window.location.href=window.location.href+"?"+Math.random(); },100); window.location.href = "/b.html"; } $(‘#atag‘).click(function(e){ open(); }) } </script> </html>