Discussões » Desenvolvimento

Modifying external script in Opera, Chrome

§
Publicado em: 21/08/2019

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
§
Publicado em: 21/08/2019
Editado em: 21/08/2019

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>.

§
Publicado em: 21/08/2019
Editado em: 21/08/2019

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?

Enviar resposta

Entre para publicar uma resposta.

长期地址
遇到问题?请前往 GitHub 提 Issues。