共用方式為


HtmlPage Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Permits access to, and manipulation of, the browser's Document Object Model (DOM).

Inheritance Hierarchy

System.Object
  System.Windows.Browser.HtmlPage

Namespace:  System.Windows.Browser
Assembly:  System.Windows.Browser (in System.Windows.Browser.dll)

Syntax

'Declaration
Public NotInheritable Class HtmlPage
public static class HtmlPage

The HtmlPage type exposes the following members.

Properties

  Name Description
Public propertyStatic member BrowserInformation Gets general information about the browser, such as name, version, and operating system.
Public propertyStatic member Document Gets the browser's document object.
Public propertyStatic member IsEnabled Gets a value that indicates whether the rest of the public surface area of the HTML Bridge feature is enabled.
Public propertyStatic member IsPopupWindowAllowed Indicates whether pop-up windows are allowed.
Public propertyStatic member Plugin Gets a reference to the Silverlight plug-in that is defined within an <object> or <embed> tag on the host HTML page.
Public propertyStatic member Window Gets the browser's window object.

Top

Methods

  Name Description
Public methodStatic member PopupWindow Opens a pop-up window.
Public methodStatic member RegisterCreateableType Registers a managed type as available for creation from JavaScript code, through the Content.services.createObject and Content.services.createManagedObject helper methods.
Public methodStatic member RegisterScriptableObject Registers a managed object for scriptable access by JavaScript code.
Public methodStatic member UnregisterCreateableType Explicitly unregisters a managed type that was previously registered by using the RegisterCreateableType method.

Top

Remarks

Two Silverlight classes can be used to access and manipulate the DOM: HtmlPage and HtmlDocument.

When the Silverlight plug-in's enableHtmlAccess property is set to false, any attempt to use the HtmlPage class fails with a NotSupportedException stating that the feature is disabled.

For information about the enableHtmlAccess property, see Security Settings in HTML Bridge.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.