[英]Keep Javascript running after reload on chrome console
So, I want to check every 15 sec on some website if some words have been deleted.因此,我想在某个网站上每 15 秒检查一次是否删除了某些单词。 I have done this:我已经这样做了:
window.setInterval(myFunction, 15000)
function myFunction()
{
//Check that "words" are not on web anymore
if ((document.documentElement.textContent || document.documentElement.innerText).indexOf('words') > -1)
{
alert("They still here");
}
else
{
alert("They are gone");
}
location.reload();
}
But becaue of the location.reload();
但是由于location.reload();
they script can only run once.他们的脚本只能运行一次。
What do I do?我该怎么办?
I think tampermonkey is what you are looking for https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo我认为 tampermonkey 是您正在寻找的https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
call timer in window.load and remove reloading of location.在 window.load 中调用计时器并删除位置的重新加载。
window.onload = function() {window.setInterval(myFunction, 15000)};
function myFunction()
{
//Check that "words" are not on web anymore
if ((document.documentElement.textContent || document.documentElement.innerText).indexOf('words') < -1)
{
alert("They are gone");
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.