博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

浏览器console自动刷新代码

Posted on 2021-06-17 11:00  红与黑hyh  阅读(519)  评论(0编辑  收藏  举报
timeout=prompt("Set timeout (Second):");
count=0
current=location.href;
if(timeout>0)
setTimeout('reload()',1000*timeout);
else
location.replace(current);
function reload(){
setTimeout('reload()',1000*timeout);
count++;
console.log('每('+timeout+')秒自动刷新,刷新次数:'+count);
fr4me='<frameset cols=\'*\'>\n<frame src=\''+current+'\'/>';
fr4me+='</frameset>';
with(document){write(fr4me);void(close())};
}