WebBrowser 禁用脚本错误提示

public partial class Text : UserControl {
        public Text()
        {                              
            InitializeComponent();           
            browser.Navigated += new NavigatedEventHandler(browser_Navigated);
        }
 
        void browser_Navigated(object sender, NavigationEventArgs e)
        {
            HideScriptErrors(browser, true);
        }
 
 
        public void HideScriptErrors(WebBrowser wb, bool Hide)
        {
            FieldInfo fiComWebBrowser = typeof(WebBrowser).GetField("_axIWebBrowser2", BindingFlags.Instance | BindingFlags.NonPublic);
            if (fiComWebBrowser == null)
                return;
 
            object objComWebBrowser = fiComWebBrowser.GetValue(wb);
 
            if (objComWebBrowser == null)
                return;
 
            objComWebBrowser.GetType().InvokeMember( "Silent", BindingFlags.SetProperty, null, objComWebBrowser, new object[] { Hide });
 
        }

上一篇:自己主动生成材质Material(Unity3D开发之十九)


下一篇:C# 微信开发-----微信会员卡(二)