Is there a way to run a content script after the page is loaded but before scripts are executed?

I’m writing a browser extension to intercept all the script tags on the page when it’s loaded, but before they execute. To be clear, I’m not looking to block the scripts entirely; I just want to intercept and analyze/modify them before they’re run.

Is there a way to do this?

I’m aware of onbeforescriptexecute for Firefox, but I’m hoping for something cross-browser…

Source: Ask Javascript Questions

LEAVE A COMMENT