Discussions » Development

Modifying external script in Opera, Chrome

§
Posted: 2019-08-21

Modifying external script in Opera, Chrome

I want to ask how to modify external script content before it's executed. In Firefox document.onbeforescriptexecute works reliably (triggered), but not so in other browsers. Can anybody advice me what construct to use that does the job in virtually any browser... Furthermore what is the proper event for @run-at clause?

wOxxOmMod
§
Posted: 2019-08-21
Edited: 2019-08-21

There's no universal solution for Chrome. Some are listed on stackoverflow.com. Sometimes you can rewrite the html of the current page (example) so that it removes the original external script and replaces it with a modified script like <script>modified code here</script>.

§
Posted: 2019-08-21
Edited: 2019-08-21

Then is there a universal code to eliminate specific calls in external script? I need to opt out adblock detection popup located in external script, provided the call is known. The script inclusion is made from root document: ...<script src="https://www.site.com/assets/js/app-dist.js"></script> You mean to replace the src attribute by modified content into .textContent?

Post reply

Sign in to post a reply.