Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Use this property when you want to access the contents of a Web page displayed in the WebBrowser control through the HTML document object model (DOM). This is useful, for example, when you want to use Web-based controls in your Windows Forms application.
You can use this property, in combination with the ObjectForScripting property, to implement two-way communication between a Web page displayed in the WebBrowser control and your application. Use the HtmlDocument::InvokeScript method to call script methods implemented in a Web page from your client application code. Your scripting code can access your application through the window.external object, which is a built-in DOM object provided for host access, and which maps to an object that you specify for the ObjectForScripting property.
The following code example demonstrates how to use the property in a handler for the Navigating event to determine whether a Web page form has been filled in. If the input field does not contain a value, the navigation is canceled.
This example requires that your form contains a WebBrowser control called webBrowser1.