01-每30秒访问某个地址

若是需要做一个30秒访问某个地址,不要使用js异步去定时,这样网页会内存溢出,这样的方式用就了网页就会卡。

而是 使用以下代码 

<!DOCTYPE html>
<html>
<head>
<title>定时器</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<h3>30秒执行一次</h3>
<iframe src="http://www.baidu.com" style="width:1200px;height:500px;"></iframe>
<iframe src="http://www.baidu.com" style="width:1200px;height:50px;"></iframe>
<script type="text/javascript">
function test(){
window.location.reload();
}
setTimeout('test()',1000*30);
</script>
</body>
</html>

 

posted @ 2018-07-27 09:55  学画人生  阅读(294)  评论(0编辑  收藏  举报