简体   繁体   English

通过Chrome中的DevTools使页面保持活动状态

[英]Keep a page alive via DevTools in Chrome

Is there a way to keep a page alive in Chrome? 有没有办法让页面在Chrome中保持活动状态? I'm monitoring something on my router GUI and it's a pain to have to login again every few minutes. 我正在路由器GUI上监视某些内容,每隔几分钟必须再次登录是很痛苦的。

I need a temporary solution which is why I wanted to go via devtools but it seems that the script I put in the console disappears on refresh. 我需要一个临时解决方案,这就是为什么我想通过devtools使用,但似乎放在控制台中的脚本在刷新后会消失。

localStorage.setItem('timer', 3 * 60 * 1000);
if (localStorage.getItem('timer') > 0) {
   setTimeout(function(){
      window.location.reload(1);
   }, localStorage.getItem('timer'));
}

This is what I have right now. 这就是我现在所拥有的。

Because the refresh will clear any user added code, unless you inject it again on refresh or as a MITM injection, you wont be able to achieve what you want. 因为刷新将清除所有用户添加的代码,除非您在刷新时或作为MITM注入再次注入代码,否则将无法实现所需的功能。

What I would suggest would be to install an auto-refresh plugin, something like Easy Auto Refresh . 我建议安装一个自动刷新插件,例如Easy Auto Refresh

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM