Disha Shukla Disha Shukla - 5 months ago 71 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.


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.