Show / Hide Table of Contents

Class HtmlDocument

Represents the HTML document in the browser.

Inheritance
System.Object
ScriptObject
HtmlObject
HtmlDocument
Implements
System.Dynamic.IDynamicMetaObjectProvider
Inherited Members
HtmlObject.AttachEvent(String, EventHandler)
HtmlObject.AttachEvent(String, EventHandler<HtmlEventArgs>)
HtmlObject.DetachEvent(String, EventHandler)
HtmlObject.DetachEvent(String, EventHandler<HtmlEventArgs>)
HtmlObject.ConvertTo(Type, Boolean)
ScriptObject.Dispatcher
ScriptObject.ManagedObject
ScriptObject.ConvertTo<T>()
ScriptObject.GetProperty(Int32)
ScriptObject.GetProperty(String)
ScriptObject.Invoke(String, Object[])
ScriptObject.InvokeSelf(Object[])
ScriptObject.SetProperty(Int32, Object)
ScriptObject.SetProperty(String, Object)
ScriptObject.IDynamicMetaObjectProvider.GetMetaObject(Expression)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows.Browser
Assembly: OpenSilver.Browser.dll
Syntax
public sealed class HtmlDocument : HtmlObject, IDynamicMetaObjectProvider

Properties

| Improve this Doc View Source

Body

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.

| Improve this Doc View Source

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
| Improve this Doc View Source

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.

| Improve this Doc View Source

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
| Improve this Doc View Source

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 Source

CreateElement(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

Implements

System.Dynamic.IDynamicMetaObjectProvider
  • Improve this Doc
  • View Source