Capturing Javascript Alert in Webbrowser Control

后端 未结 2 1096
失恋的感觉
失恋的感觉 2021-01-27 04:59

Using the webbrowswer control to cruise a site. Sometimes errors occur which involve a javascript popup box. I would like to do a couple of things when this happens.

2条回答
  •  悲哀的现实
    2021-01-27 05:44

    Just do this:

    window.alert = function(txt) {
       // Do something
    }
    

    This will allow you to do a callback or anything else you want with the alert text.

提交回复
热议问题