0

I have an application that uses WebBrowser control to navigate from page to page, on some pages I get a leaving popup asking me if that's what I want to do.. this stops the whole further execution until I press "Leave" or "Stay".. How can I disable them?

What I've tried so far were these actions: a) setting window.onbeforeunload = null; b) setting alert, confirm, prompt to an empty function c) settin suppressErrorMessages to true

but even so, I still get the nasty message in the end.

I mostly relied on this answer: How to update DOM content inside WebBrowser Control in C#?

But so far without a success. The alerts seem to be jQuery alerts because they have custom texts (instead of OK Cancel, they have Stay Leave)..

Any help hugely appreciated!!

Community
  • 1
  • 1
Pete Kozak
  • 493
  • 1
  • 4
  • 21

1 Answers1

0

The webbrowser control uses IE internally and IE has a prompt if you've filled out a form asking you if you really want to leave the page (thereby losing the content you've filled out) perhaps that's what you're seeing?

i'm just shooting from the hip here but you could try clearing all inputs before navigating.

aL3891
  • 6,205
  • 3
  • 33
  • 37
  • nah, this is just a typical message from "badly designed" websites convincing you to stay there forever.. I was trying to find it in the html but there are thousands of javascript lines so it's making it almost impossible to handle that way.. I was just curious if there is a way of blocking popups? can this be done by switching them off in IE itself cause Im not using it anyway? Also found this: http://stackoverflow.com/questions/9770522/how-to-handle-message-boxes-while-using-webbrowser-in-c but will use it only as a last chance. – Pete Kozak May 31 '14 at 22:59