Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

BrowserInteropHelper::HostScript Property

.NET Framework (current version)
 

Gets a script object that provides access to the HTML window object, custom script functions, and global variables for the HTML page, if the XAML browser application (XBAP) is hosted in a frame.

Namespace:   System.Windows.Interop
Assembly:  PresentationFramework (in PresentationFramework.dll)

public:
property Object^ HostScript {
	[SecurityCriticalAttribute]
	[SecurityTreatAsSafeAttribute]
	static Object^ get();
}

Property Value

Type: System::Object^

A script object that provides access to the HTML window object, custom script functions, and global variables for the HTML page, if the XAML browser application (XBAP) is hosted in a frame; otherwise, null.

With the returned HostScript object, you can access the properties, methods, and events of the HTML window object, call a script function directly, or access a global variable. The syntax to access these items uses the familiar dot notation.

For more information about the window object, see window object in the Dynamic HTML (DHTML) documentation.

The HostScript property returns null if the frame is navigated to from a cross-domain location.

This feature can be turned off for Internet Explorer by setting the ScriptInteropDisallow registry value. For more information, see Security (WPF).

The following example demonstrates how to retrieve the HostScript object and close the browser window.

<Grid>
   <Button Width="160" Height="60" Click="Button_Click" Content="Close Browser Window" />
 </Grid>
No code example is currently available or this language may not be supported.

.NET Framework
Available since 4.0
Return to top
Show:
© 2017 Microsoft