Disha Shukla Disha Shukla - 1 year ago 158 Question

Web Browser Control prevent Are you sure you want to leave this page

I have an application which is used to navigate to another page, a Kind of web browser, The problem is for some web pages it says "Are you sure you want to leave this page ? " dialogue. I want to remove it totally. It should start navigating without this dialogue. I tried this,

WebBrowser.ScriptErrorsSuppressed = True

Screenhot :

I have also tried to disable javascript but no luck. Any help would be appreciated.

Answer Source

The JavaScript onbeforeunload event is responsible to handle such messages. By setting it to null as:

window.onbeforeunload = null;

you can prevent its handlers code from running.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download