Answer the question
In order to leave comments, you need to log in
How to use userscript to replace the script on the page?
There was a need to replace the script on someone else's site. I am using tampermonkey.
Tried similar
document.getElementsByTagName("script")[0].innerHTML = newScript;
Answer the question
In order to leave comments, you need to log in
What exactly didn't work for you? If you make the original script stop working, it’s natural, it is interpreted when the page is loaded, written to memory and works from there, so you can rewrite it at least a hundred times in the page code, it’s neither hot nor cold.
And your script is already added to the page, in the sense that the code called from Tampermonkey does not need to be written anywhere in the script tag on the page. It will work anyway, the main thing is that some work should take place in the script itself.
What exactly do you need to replace, write. What actions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question