[WinForm] Debug the script in WebBrowser, winformwebbrowser

Source: Internet
Author: User
Tags url example

[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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.