Article ID: 261003
The WebBrowser control notifies its host of an unhandled script error through the IOleCommandTarget interface. The host can then retrieve the information about the error, display (or suppress) an error message to the user, and choose whether to run scripts on the page.
When one of the script engines encounters an unhandled error, it forwards the error to the WebBrowser control, which then queries its container to see if the container has implemented IOleCommandTarget. If the container has implemented IOleCommandTarget, the WebBrowser control calls the IOleCommandTarget::Exec method with the command group ID of CGID_DocHostCommandHandler (which is defined in the Mshtmhst.h file) and a command ID of OLECMDID_SHOWSCRIPTERROR. If the host does not return S_OK, MSHTML displays the default "An error has occurred on this page" error message.
The following code illustrates how to implement a handler for this command ID that retrieves the error information from the document object model. This code does not illustrate error handling.
NOTE: This method will not be invoked if the user has cleared the Disable Script Debugging check box in the Advanced tab under Internet Options.
For additional information on implementing the IOleCommandTarget interface, please see the following Microsoft Developer Network (MSDN) Web site:
http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/com/oin_oc_9bg4.htmFor more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
Article ID: 261003 - Last Review: June 19, 2014 - Revision: 4.0
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Contact us for more help