Using webbrowser to retrieve pages is relatively simple, and there is an example in msdn. You don't need to mention it here.
However, some HTML documents are composed of "frameworks", or they can store their own unique HTML document windows. You can use a framework to easily create HTML pages. One or more pages of an HTML page remain static while other frameworks continuously change their content, such as the navigation bar.
HTML authors can use either of the following two methods to create a framework:
-Or-
Because frameworks contain HTML documents, they are represented as window elements and framework elements in the Document Object Model (DOM.
When using the htmlwindow framework set to accessFrameOrIFRAMETag, that is, to retrieve the window elements corresponding to this framework. All the dynamic attributes of the framework, such as its current URL, document, and size.
UseHtmlwindow, Children collection, getelementsbyname, getelementbyid, and other methods.FrameOrIFRAMEWhen marking, that is, retrieving framework elements. This refers to the static attributes of the framework, including the URLs specified in the original HTML file.
Framework and security
Access to the framework is complicated because the security measures hosted by HTML Dom are called "cross-framework scripting Security. If the document containsFramesetTwo or moreFrameIn different domainsFrameCannot interact with each other. In other wordsFrameUnable to access hosts third-party sites such as http://www.adatum.com/Frame. InHtmlwindowClass-level security. You can obtainFrameBut cannot access its document or change its host.FrameOrIFRAME.
This rule also applies to Windows opened using the open and opennew methods. If the domain of the window you open is different from the domain of the page hosted in the webbrowser control, you cannot move the window or check its content. When you useWebbrowserDisplay and deploy an application based on Windows FormsProgramThese restrictions are also enforced when different websites are used. If you use the clickonce deployment technology to install applications from website a, useWebbrowserIf website B is displayed, you cannot access the data of website B.
For more information about cross-site scripting, see about cross-frame scripting and Security (about cross-framework scripting and security) (http://msdn.microsoft.com/library/default.asp? Url =/Workshop/author/OM/xframe_scripting_security.asp ).
See Other resources
Use the managed HTML Document Object Model
Frame Element | frame object
1. Get the source file of the frame.
MessageBox. Show (webbrowser1.document. Window. Frames ["Main"]. Document. Body. innerhtml );
2. Obtain the htmldocument interface of the frame.
Htmldocument Doc = (htmldocument) webbrowser1.document. domdocument;
Object J;
For (INT I = 0; I <Doc. parentwindow. frames. length; I ++)
{
J = I;
Htmlwindow2class frame = Doc. parentwindow. frames. Item (ref J) as htmlwindow2class;
If (frame. Name = "Main ")
{
Messagebox.show(frame.doc ument. Title );
}
}
3. Obtain the ihtmldocument2 interface of the frame.
Ihtmldocument2 Doc = (ihtmldocument2) webbrowser1.document. Window. Frames ["Main"]. Document. domdocument;
4. Get the clicked connection in the frame
Private void webbrowser1_navigating (Object sender, webbrowsernavigatingeventargs E)
{
String url = webbrowser1.document. Window. Frames ["Main"]. Document. activeelement. getattribute ("src ");
}