For example, in the Html page there is this:

<script> alert('hi'); </script> 

How to use the extension to cancel the execution of this script?

  • No If it is not physically cut from the page before building the Dom model and launching the sandbox. - Dmitry Gvozd
  • Chrome extension to block dialogs . Question / answer on your topic. - UserName
  • <noscript> ? : D - smellyshovel

1 answer 1

In general, if an extension has access to a window, it is done simply; we reassign the function and that's it:

 window.alert = function(){return false;} 
  • Tried, this script disables the alert in the extension code, but not in the page code. The manifest in "matches" contains a link to the site. It's enough? - Tim
  • I did not write 3 extensions for a year, I don’t know what has changed, try it so habrahabr.ru/post/186762 - gibigate