Search code examples
c++internet-explorererror-handlingiwebbrowser2

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


Solution

  • The docs you are reading refer to what you can do if you embed an IE HTML rendering pane in your own application. They allow you to alter the behavior of that pane.

    If you have done that, then you can use COM to QueryInterface an IWebBrowser2 interface from the component.

    See more here:

    http://support.microsoft.com/kb/196340

    And here's how you handle errors:

    http://support.microsoft.com/kb/261003

    I suspect that that's not what you are trying to do, and that you are just making a web-app. In that case, you need to

    1. Fix your JS errors
    2. Put all of your JS code in try/catch blocks. Then you won't get JS dialogs, but you need to handle the error yourself.