If you only want to suppress script errors, handle OLECMDID_SHOWSCRIPTERROR from the CGID_DocHostCommandHandler command group in your host's IOleCommandTarget implementation. To handle this in Windows Forms's WebBrowser class, you need your own WebBrowserSite class that implements IOleCommandTarget and use it as your webbrowser's control site. If you host the ActiveX version of IE directly, check https://code.google.com/p/csexwb2/
Note implementing IOleCommandTarget will have the webbrowser control routing all kinds of commands (e.g. OLECMDID_PRINT, OLECMDID_SHOWPAGEACTIONMENU, OLECMDID_PASTESPECIAL,OLECMDID_SETPROGRESSPOS, etc) to the host. If you are not interested in changing the default behavior for those commands, remember to return OLECMDERR_E_NOTSUPPORTED (if you handle the group but not the command) or OLECMDERR_E_UNKNOWNGROUP, otherwise your application may crash.
转自http://jiangsheng.blogspot.com/2005_07_01_archive.html
Note implementing IOleCommandTarget will have the webbrowser control routing all kinds of commands (e.g. OLECMDID_PRINT, OLECMDID_SHOWPAGEACTIONMENU, OLECMDID_PASTESPECIAL,OLECMDID_SETPROGRESSPOS, etc) to the host. If you are not interested in changing the default behavior for those commands, remember to return OLECMDERR_E_NOTSUPPORTED (if you handle the group but not the command) or OLECMDERR_E_UNKNOWNGROUP, otherwise your application may crash.
转自http://jiangsheng.blogspot.com/2005_07_01_archive.html