Capturing javascript popups

后端 未结 2 435
走了就别回头了
走了就别回头了 2021-01-27 02:05

In WebBrowser, is there anyway to capture the stupid popups that are generated by javascript?

The ones which say \"Success\" or watever and have the \"Ok\" button.

2条回答
  •  隐瞒了意图╮
    2021-01-27 02:56

    You could simply redefine the global javascript alert function like this:

    function alert() {}
    

    then nothing will happen when other code calls the alert.

    UPDATE:

    to do this add the following to your page code:

    
    

    If you are injecting it to your pages then you may wish to look at greasemonkey and then add this script using that:

    https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/

    there are similar addons for all browsers.

提交回复
热议问题