[WinForm] Debug the script in WebBrowser, winformwebbrowser
Recently, I used WebBrowser to present Baidu map. I need to debug the script and search for it to add a debugger to js. Then I can debug it. After several attempts, I found that the following settings are required:
1. Set IE,
2. Set the WebBrowser attribute ScriptErrorsSuppressed to True.
3. Add a debugger to the script to be debugged;
Effect:
Hope this is helpful!
In c #, how does the webbrowser control of winform obtain buttons or <a> events in the form?
HtmlElement btn = this. webBrowser1.Document. getElementById ("Enter the button here or the id of the tag ");
Btn. Click + = btn_Click;
Private void btn_Click (object sender, HtmlElementEventArgs e ){
// Here is your operation to open a new window Form1
}
How to Use the WebBrowser control in winform to display the specified URL example
One line of code:
WebBrowser. Navigate ("the specified URL you want to display ");
Or you can write your specified URL in the webBrowser attribute.