Friday 15 May 2015

javascript - Keep the console script persistent in Google Chrome -


I have a script that I want to use in the Google Chrome console. But this script is going to reload the page. Slightly like this:

  setInterval (function () {location.reload ();}, 3000);   

The problem is, once it is reloaded, the script closes and the console is clear I tried the "Save log on navigation" option: This log Protects, but the script does not restart after reloading.

How should I do? Thank you :)

Actually there is no way to do this. The only possible way I found was to develop the Chrome extension and put your script on it. Your script will be removed every time the target page loads, so when you execute the location. Refresh () method, the next time the page is loaded, your script will be executed again and again. If you want to keep some data between page loads, then you can use local storage.


Get more info here - how to inject script through extensions:

Remember that the scope of the extension is separated from the rest of the page, so you You can not use the declared JS variable or function directly from an extension, but you can interact with the DOM. Best wishes

No comments:

Post a Comment