Generally, the webbrowser control scripterrorssuppressed is set to true. The script error dialog box cannot be displayed. The scripterrorssuppressed attribute encapsulates the silent attribute of the basic COM control, therefore, setting the scripterrorssuppressed attribute is the same as setting the slient attribute of its basic COM control. windows. the forms assembly can be confirmed.
Note that:
Setting scripterrorssuppressed to true disables all dialogs, such as prompting ActiveX download, execution, and secure logon.
If you do not want to disable a dialog box other than a script error, use the sample code on msdn:
View code
Private void browser_documentcompleted (Object sender, webbrowserdocumentcompletedeventargs E)
{
(Webbrowser) sender). Document. Window. Error + = new htmlelementerroreventhandler (window_error );
}
Private void window_error (Object sender, htmlelementerroreventargs E)
{
// Ignore the error and suppress the error dialog box.
E. Handled = true;