1

I have a page that loads javascript using a <script src="some/script.js"> tag. I wanted to replace a string in the external javascript file. And I found no way to do this in chrome. local overrides could work, but I don't want to keep the devtools open to make this work.

I tried the following

window.onbeforescriptexecute = function(e)=>(modifier code)

or

window.addEventListener("beforescriptexecute", (e)=>{modifier code});

But they don't work at all. I also tried this snippet here, still with no luck.

How can I make this work?

Abraham
  • 12,140
  • 4
  • 56
  • 92
  • Does this answer your question? [How can I edit javascript in my browser like I can use Firebug to edit CSS/HTML?](https://stackoverflow.com/questions/6657229/how-can-i-edit-javascript-in-my-browser-like-i-can-use-firebug-to-edit-css-html) – ikhvjs Mar 02 '22 at 11:02
  • The code here seems overly truncated. What is the `modifier code` stub exactly? Which string do you want to replace in which external file? Please share a [mcve] of the modification you want to make and your full code attempt so far. Thanks. – ggorlen Mar 19 '22 at 06:23

0 Answers0