如何让计时器在 html 中打开另一个 html 文件

How do I make an timer open another html file in html

所以我无法找到如何在一定秒数后从 html 文件打开另一个 html 文件! 我的文件名为 homepagewebsite.html 但我希望它打开 menu.html

请帮忙!!!

像下面这样使用JavaScript:

赞:homepagewebsite.html

<body onload=startTimer();>
<script>
function startTimer(){
var tt = setInterval(function() {
    window.open ('menu.html','_self',false)
},5000);
}
</script>

menu.html

<html>
<body>
   New page
</body>
</html>
<script>
  var iframe = window.getElementsByTagName( "iframe" )[ 0 ];
  alert( "Frame title: " + iframe.contentWindow.title );
</script>


<iframe src="page.html" width="300" height="300">
  <p>Your browser does not support iframes.</p>
</iframe>

在另一个选项卡的 iframe 中打开 link

<base target="_blank" />
<iframe width="400" height="215" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"
   src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=es-419&amp;geocode=&amp;q=buenos+aires&amp;sll=37.0625,-95.677068&amp;sspn=38.638819,80.859375&amp;t=h&amp;ie=UTF8&amp;hq=&amp;hnear=Buenos+Aires,+Argentina&amp;z=11&amp;ll=-34.603723,-58.381593&amp;output=embed">
</iframe><br />
<small>
    <a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=es-419&amp;geocode=&amp;q=buenos+aires&amp;sll=37.0625,-95.677068&amp;sspn=38.638819,80.859375&amp;t=h&amp;ie=UTF8&amp;hq=&amp;hnear=Buenos+Aires,+Argentina&amp;z=11&amp;ll=-34.603723,-58.381593"
       style="color:#0000FF;text-align:left">
        See bigger map
    </a>
</small>

只需检查 SmoothState.js 是图书馆,你可以打开你的 html 页面而不刷新页面,如果你在 jQuery 中是完美的,那么你可以在点击事件上添加计时器,当你点击注册到 DOM 然后 DOM 等待几秒钟然后 smoothState.js 打开下一个 HTML 页面。

http://weblinc.github.io/jquery.smoothState.js/