Removing modeless dialog from WebBrowser control.


S

Sin Jeong-hun

I've found that if a MessageBox (called by alert/confirm from
Javascript) or a web page modeless dialog is popped up, I cannot call
Navigate of the WebBrowser control. If I do, a COM exception occures.

How can I disable javascript MessageBoxes or modeless dialogs? I
disabled normal popup windows by adding e.Cancel=true at the browsers
newwindow event. But I couldn't disable modeless dialog or javascript
MessageBox. I tried to remove some specific javascript code by

WebBrowser.DocumentText=WebBrowser.DocumentText.Remove("alert(","//alert(");

at the WebBrowser's DocumentComplete event, but this caused endless
loop. I guess if I modify the DocumentText, DocumentComplete is called
again.

So, what is the recommended way?
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top