Is there a way to enable the IE8 Developer Tools from inside WebBrowser control in a .NET application

后端 未结 5 1768
青春惊慌失措
青春惊慌失措 2021-02-12 11:22

If you have IE8, you may have noticed a really handy feature that MS has added. Hit F12 and Developer Tools, a firebug like debugger, pops up. This is extremely useful for debug

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-12 11:38

    No, as others have said this is not possible. However there is a way you can wire most of the window errors through to a custom handler. Once the document has finished loading you can attach a listener to the window. e.g.

    webBrowser.DocumentCompleted += (o, e) =>
    {
        webBrowser.Document.Window.Error += (w, we) =>
        {
            we.Handled = true;
    
            // Do something with the error...
            Debug.WriteLine(
                string.Format(
                   "Error: {1}\nline: {0}\nurl: {2}",
                   we.LineNumber, //#0
                   we.Description, //#1
                   we.Url));  //#2
        };
    };
    

提交回复
热议问题