html页面实现自动刷新
有些时候需要定时自动的去刷新页面,更新数据之类的,下面告诉你个好方法,既省事,又省力哈
1、页面自动刷新(H5格式的html页面,只需要在head中添加)
<!-- 1、设置时间10秒刷新一次该页面 --> <meta http-equiv="refresh" content="10"> <!-- 2、设置指定时间跳转 --> <meta http-equiv="refresh" content="10;url=https://aihongxin.com">
2、使用js实现页面的自动刷新
<script> function myrefresh() { window.location.reload(); } setTimeout('myrefresh()', 1000); //指定1秒刷新一次 </script>