Class HtmlDocument
Represents the HTML document in the browser.
Implements
Inherited Members
Namespace: System.Windows.Browser
Assembly: OpenSilver.Browser.dll
Syntax
public sealed class HtmlDocument : HtmlObject, IDynamicMetaObjectProvider
Properties
| Improve this Doc View SourceBody
Gets a reference to the BODY element of the HTML document.
Declaration
public HtmlElement Body { get; }
Property Value
Type | Description |
---|---|
HtmlElement | The HTML document's BODY element. |
Cookies
Gets or sets the browser's cookie string. If the browser does not have a cookie string, the property returns an empty string.
Declaration
public string Cookies { get; set; }
Property Value
Type | Description |
---|---|
System.String |
DocumentElement
Gets a reference to the browser's DOCUMENT element.
Declaration
public HtmlElement DocumentElement { get; }
Property Value
Type | Description |
---|---|
HtmlElement | The browser's DOCUMENT element. |
DocumentUri
Gets a Uniform Resource Identifier (URI) object that represents the current HTML document.
Declaration
public Uri DocumentUri { get; }
Property Value
Type | Description |
---|---|
System.Uri |
QueryString
Gets a navigable, read-only collection of name/value pairs that represent the query string parameters on the current page's URL.
Declaration
public IDictionary<string, string> QueryString { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.String> |
Methods
| Improve this Doc View SourceCreateElement(String)
Creates a browser element.
Declaration
public HtmlElement CreateElement(string tagName)
Parameters
Type | Name | Description |
---|---|---|
System.String | tagName | The tag name of the browser element to create. |
Returns
Type | Description |
---|---|
HtmlElement | A reference to a browser element. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | tagName is an empty string. |
System.ArgumentNullException | tagName is null. |
System.InvalidOperationException | An unexpected error occurred. |
GetElementById(String)
Gets a single browser element.
Declaration
public HtmlElement GetElementById(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A string identifier for a named browser element. |
Returns
Type | Description |
---|---|
HtmlElement | A reference to a browser element. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | id is an empty string. |
System.ArgumentNullException | id is null. |
System.InvalidOperationException | An unexpected error occurred. |
GetElementsByTagName(String)
Gets a collection of browser elements.
Declaration
public ScriptObjectCollection GetElementsByTagName(string tagName)
Parameters
Type | Name | Description |
---|---|---|
System.String | tagName | A browser element's tag name. |
Returns
Type | Description |
---|---|
ScriptObjectCollection | A collection of references to HTML elements that correspond to the requested tag name. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | tagName is an empty string. |
System.ArgumentNullException | tagName is null. |
System.InvalidOperationException | An unexpected error occurred. |