我希望我的html代碼打開Google Page並每隔5秒刷新一次。 我寫的代碼,它在5秒後打開谷歌頁面,但它不刷新或重新加載它。我怎樣才能做到這一點?自動重新加載Google頁面
這裏是代碼:
<html>
<head>
<script>
setInterval(function(){
window.location.href ="https://www.google.com.pk/";
}, 5000);
</script>
</head>
<body>
</body>
</html>
您不能刷新不屬於您自己的頁面,除非它在iframe中。 http://stackoverflow.com/questions/3244877/refresh-an-iframe – Jacques
你能解釋一下iframe的含義嗎? –
而iframe是一個dom元素,允許您在您的內部顯示另一個網頁。 https://www.w3.org/wiki/HTML/Elements/iframe – Jacques