In Webbroswer, you can embed a Web page file that is bound by a URL property.
A URI, Uniform Resource Identifier, used to uniquely identify a resource.
URL, a Uniform Resource locator, which is a specific URI that a URL can use to identify a resource.
It contains information that indicates the location of the file and how to handle it.
The protocols that can be processed include: Http,https,ftp,mailto,ldap,file,news,gopher,telnet.
It should also be possible to only try HTTP and File,https in Webbroswer in the form of HTTP encryption.
HTTP is a hyperlink form, which is a link on the web.
File is the form of local files that can display a local HTML file in the Webbroswer.
1.WebBroswer can monitor Web page load Complete event, documentcompleted event.
2. Monitor the element document.getElementById ("id") on the Web page;
3. Monitor element related events, such as monitoring click events. Htmlelement.click+=htmlelement_click; Register a Click event
4. Execute JavaScript code, String msg=document.invokescript ("Demofuc", New string[]{"Demo"}) as String;
Where MSG is the data returned by the JS code, here is the string type of data, if JS returns an object, the foreground receives a COM type object, currently does not handle
Demofunc the name of a method that is well defined for JS
If there are parameters that need to be transferred in a object[] way, to actually get only the value of the first element
5. Can get information about trigger object when triggering event
private void Btn_click (object sender, HtmlElementEventArgs e)
{
HtmlElement msgbtn = sender as htmlelement;//convert sender to HtmlElement type
if (gohomemsgbtn.id = = "... ")//Get the ID of the element
{
}
}
string Path =string": /.. /demo.html"new uri" (new uri (path), URI),//concatenation URI, and assign value to Webbroswer
Use of the C#webbroswer control