0

I would like to modify a piece of javascript that gets loaded by a webpage before that code actually is executed. I know where the line of code I want to modify is, and I can use the browser debugger to set a breakpoint just before that line, however, once the execution is paused I'm unable to modify the script code.

Does anyone know how to achieve this?

PS: Please note that all the rest of the script can remain identical to the original, and I don't want to block all javascript execution, just change a single (or a few) line before my browser runs it.

3
  • Are you changing it permanently or temporarily? Commented Apr 21, 2020 at 16:04
  • @AvivLo temporarily I suppose? I don't have control over the server that is providing me the script, so I am only interested in local changes in the browser in the current "loading" of the page. Commented Apr 22, 2020 at 4:06
  • You will probably have to write another script that changes the script that you want to modify before you actually load it. This is just a theory. Commented Apr 22, 2020 at 11:37

1 Answer 1

1

This is tantamount to override, and there is already a question that answer that

Override Javascript file in chrome

Personally I would go with the local override option as described here

Sign up to request clarification or add additional context in comments.

1 Comment

Interesting, I hoped there would be an easier, and less browser-specific solution, but this is a good start. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.