How to override the alert function with a userscript?

后端 未结 2 457
情歌与酒
情歌与酒 2020-11-30 10:46

On site there is code like that (its site on LAN)



        
2条回答
  •  青春惊慌失措
    2020-11-30 11:03

    If you use Scriptish then the following will always work:

    // ==UserScript==
    // @id              alert-killer-test@erikvold.com
    // @name            Overwrite Alert
    // @description     Overwrites alert()
    // @include         *
    // @run-at          document-start
    // ==/UserScript==
    
    unsafeWindow.alert=function() {};
    

    You can get the user script here.

提交回复
热议问题