disable all javascript events on page

前端 未结 3 1770
耶瑟儿~
耶瑟儿~ 2021-01-22 14:46

I am trying to write a chrome extension that disables event listeners for all elements (mouseover, click, ...) I am not trying to rewrite noscript, this is just a setup step tha

3条回答
  •  被撕碎了的回忆
    2021-01-22 15:02

    This is not a complete example, as I won't do all of your work for you, but might lead you in the right direction:

    function preventAll(){
      var dom = document.getElementsByTagName('*');
      var km = ['click', 'dblclick', 'mousedown', 'mousemove', 'mouseover', 'mouseout', 'mouseup', 'mouseenter', 'mouseleave', 'keydown', 'keypress', 'keyup'];
      for(var i=0,l=dom.length; i

提交回复
热议问题