Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just want to know the way of blocking message box from IE by using SHDocVw.InternetExplorer.

Before I have used the code below with WebBrowser
HtmlElement head = wb.Document.GetElementsByTagName("head")[0];
HtmlElement scriptEl = wb.Document.CreateElement("script");
IHTMLScriptElement element = (IHTMLScriptElement)scriptEl.DomElement;
string alertBlocker = "window.alert = function () { }";
element.text = alertBlocker;
head.AppendChild(scriptEl);

But, Now I'm handling with SHDocVw.InternetExplorer.

So Is there any method to block or click directly after navigation event fired?

Maybe simply removing 'alert' element would be working?

Any help is greatly appreciated.
Posted
Comments
[no name] 13-Nov-14 9:50am    
What alert are you talking about?

Here is a list of WebBrowser Events you can use.
Member 10874313 13-Nov-14 11:21am    
Yeah, but the InternetExplorer instance is handled outside of my application.
I could not use the WebBrowser and SHDocVw.InternetExplorer has different functions to compare WebBrowser.
ZurdoDev 13-Nov-14 9:51am    
You want to block the alert() function? Why?
[no name] 13-Nov-14 9:55am    
Oh, does he mean suppressing errors Ryan? Then this might do:
wb.ScriptErrorsSuppressed = true;
Member 10874313 13-Nov-14 11:20am    
When I scrap the documents from IE, if the alert() function appears then my application gets freeze.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900