HtmlWindow Class
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Provides the managed representation of the JavaScript window object.
Inheritance Hierarchy
System.Object
System.Windows.Browser.ScriptObject
System.Windows.Browser.HtmlObject
System.Windows.Browser.HtmlWindow
Namespace: System.Windows.Browser
Assembly: System.Windows.Browser (in System.Windows.Browser.dll)
Syntax
'Declaration
Public NotInheritable Class HtmlWindow _
Inherits HtmlObject
public sealed class HtmlWindow : HtmlObject
The HtmlWindow type exposes the following members.
Properties
Name | Description | |
---|---|---|
CurrentBookmark | Gets or sets a string that represents the hash value of the current page's URL. | |
Dispatcher | Gets an instance of the dispatcher. (Inherited from ScriptObject.) | |
ManagedObject | Gets the underlying managed object reference of the ScriptObject. (Inherited from ScriptObject.) |
Top
Methods
Name | Description | |
---|---|---|
Alert | Displays a dialog box that contains an application-defined message. | |
AttachEvent(String, EventHandler) | Attaches the specified .NET Framework event handler (EventHandler) to the specified event on the current Document Object Model (DOM) object. (Inherited from HtmlObject.) | |
AttachEvent(String, EventHandler<HtmlEventArgs>) | Attaches the specified .NET Framework event handler (EventHandler<TEventArgs>) to the specified event on the current Document Object Model (DOM) object. (Inherited from HtmlObject.) | |
CheckAccess | Determines whether the current thread is the browser's UI thread. (Inherited from ScriptObject.) | |
Confirm | Displays a confirmation dialog box that contains an optional message as well as OK and Cancel buttons. | |
ConvertTo(Type, Boolean) | Converts the current object to a specified type. This method is not supported. (Inherited from HtmlObject.) | |
ConvertTo<T>() | Converts the current scriptable object to a specified type. (Inherited from ScriptObject.) | |
CreateInstance | Creates an instance of the specified JavaScript type. | |
DetachEvent(String, EventHandler) | Detaches the specified.NET Framework event handler (EventHandler) from the specified event on the current Document Object Model (DOM) object. (Inherited from HtmlObject.) | |
DetachEvent(String, EventHandler<HtmlEventArgs>) | Detaches the specified .NET Framework event handler (EventHandler<TEventArgs>) from the specified event on the current Document Object Model (DOM) object. (Inherited from HtmlObject.) | |
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Eval | Evaluates a string that contains arbitrary JavaScript code. | |
Finalize | Frees resources and performs other cleanup operations before the scriptable object is reclaimed by garbage collection. (Inherited from ScriptObject.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetProperty(Int32) | Gets the value of a property that is identified by ordinal number on the current scriptable object. (Inherited from ScriptObject.) | |
GetProperty(String) | Gets the value of a property that is identified by name on the current scriptable object. (Inherited from ScriptObject.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Initialize | Infrastructure. Initializes a scriptable object. (Inherited from ScriptObject.) | |
Invoke | Invokes a method on the current scriptable object, and optionally passes in one or more method parameters. (Inherited from ScriptObject.) | |
InvokeSelf | Invokes the current ScriptObject and assumes that it represents a JavaScript method. (Inherited from ScriptObject.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Navigate(Uri) | Opens the specified page in the current browser. | |
Navigate(Uri, String) | Opens the specified page in the specified browser instance. | |
Navigate(Uri, String, String) | Opens the specified page in the specified browser instance, with the indicated user interface features. | |
NavigateToBookmark | Changes the URL of the current page to a location that is specified by a named bookmark. | |
Prompt | Displays a dialog box that prompts the user with a message and an input field. | |
SetProperty(Int32, Object) | Sets the value of a property that is identified by ordinal number on the current scriptable object. (Inherited from ScriptObject.) | |
SetProperty(String, Object) | Sets a property that is identified by name on the current scriptable object. (Inherited from ScriptObject.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
IDynamicMetaObjectProvider.GetMetaObject | Returns the DynamicMetaObject responsible for binding operations performed on this object. (Inherited from ScriptObject.) |
Top
Remarks
When the Silverlight plug-in's enableHtmlAccess property is set to false, any attempt to use the HtmlWindow class fails with a NotSupportedException stating that the feature is disabled.
For information about the JavaScript window object, see the window object in the dynamic HTML (DHTML) documentation.
For information about the enableHtmlAccess property, see Security Settings in HTML Bridge.
If you are using Safari version 2 or 3 on a Macintosh computer, comparing two or more managed HtmlWindow references that point to the same Document Object Model (DOM) window reference returns false.
Examples
The following example accesses a page that has one IFRAME. HTML Bridge methods are used to get two references to the IFRAME.
HtmlWindow htmlWin1 = HtmlPage.Window;
HtmlWindow htmlWin2 = HtmlPage.Window;
The following comparison returns false on Safari 2 or 3 on a Macintosh computer:
bool areEqual = (htmlWin1== htmlWin2);
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.