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.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.