Add the timer code in the chrome console, how can the code continue to execute after the page is refreshed?

for example, write a timer in the console and call a method in the page regularly, but the page will be refreshed after the method is executed, so the timing code of the console will be invalid after the page is refreshed. Is there any way to solve it?


record the time in cookies, and then compare the current time with the time recorded by cookies.


the method of this article can be https://blog.csdn.net/samt007.

.
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);
    countPP;
    console.log(''+timeout+',:'+count);
    fr4me='<frameset cols=\'*\'>\n<frame src=\''+current+'\'/>';
    fr4me+='</frameset>';
    with(document){write(fr4me);void(close())};
}

realize "automatic refresh" by reloading the contents of frame (that is, current links) by using frame nesting target web page links

Menu