Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Supressing Script Error in IE8 (C++)

I want to prevent IE from showing JS error dialogs, I read that it can be done by setting ScriptErrorsSuppressed = true.

Where exactly do I set it in IWebBrowser2?

Thanks

like image 567
kambi Avatar asked Feb 23 '23 19:02

kambi


2 Answers

Simply use put_Silent method.

m_pWebBrowser->put_Silent(VARIANT_TRUE);
like image 63
KAdot Avatar answered Mar 07 '23 02:03

KAdot


As mentioned earlier, use the put_Silent() method to turn error reporting on or off.

For example, if using a CDHtmlDialog, put this in your OnInitDialog():

m_pBrowserApp->put_Silent(VARIANT_TRUE);

and put it before the LoadFromResource() call.

Be careful though as this will suppress a lot more messages than just JavaScript errors. (Think SSL certificate notifications.)

like image 45
prcarp Avatar answered Mar 07 '23 03:03

prcarp