简体   繁体   English

在特定的Google Chrome选项卡上执行javascript

[英]Execute javascript on a specific Google Chrome tab

I'm running this javascript to click a link through my Chrome browser 我正在运行此JavaScript,以通过我的Chrome浏览器单击链接

document.getElementById('extractResults').click();

It's clicking fine, until I navigate away from the browser tab or window. 一切正常,直到我离开浏览器选项卡或窗口。 Any insights into how to execute the action even after I've navigated away from the tab? 即使在我离开标签页后,仍对如何执行操作有任何见解?

Thanks! 谢谢!

I guess it depends on how you're "running this javascript"... are you using setInterval() or something similar? 我猜这取决于您如何“运行此javascript” ...您使用的是setInterval()还是类似的东西?

You might do a google search for "javascript background tabs" -- there are a lot of related issues (such as this and this ) and the bottom line seems to be that modern browsers are saving CPU (etc) by not running everything when in the background. 您可能会在Google上搜索“ javascript背景标签”-有很多相关问题(例如thisthis ),最重要的是,现代浏览器通过在运行时不运行所有程序来节省CPU(等)的背景。

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

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