How to run JavaScript code continously in browser console even after page reload

2.8k Views Asked by At

I am trying to run a JavaScript code, something like this document.getElementById('someID').innerHTML = ''; in a web browser console. It works fine until the page is refreshed or redirected to another page. Soon after the page refreshes the console gets erased, and I have to manually run it again. Is there a way to run JavaScript code continuously in the browser console even after the page reloads, or is there any other way (externally from the browser console) to accomplish the above task?

2

There are 2 best solutions below

0
On

You can try tamper monkey there are chrome and firefox versions https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en

0
On

GreaseMonkey is one more option for Firefox to run external js along with page loaded js