Windows Dev Center

Expand Minimize

WebView.InvokeScriptAsync method

As an asynchronous action, executes the specified script function from the currently loaded HTML, with specific arguments.

Syntax


public:
IAsyncOperation<String>^ InvokeScriptAsync(
  String^ scriptName, 
  Array<String^>^ arguments
)

Parameters

scriptName

Type: System.String [.NET] | Platform::String [C++]

The name of the script function to invoke.

arguments

Type: System.String[] [.NET] | Platform::Array<Platform::String> [C++]

A string array that packages arguments to the script function.

Return value

Type: IAsyncOperation<String>

When this method returns, the string result of the script invocation.

Remarks

Note  To prevent malicious code from exploiting your app, be sure to call this method to invoke only scripts that you trust.
 

The invoked script can return only string values.

Your app might appear unresponsive while scripts are running. Handle the LongRunningScriptDetected event to interrupt a long-running script.

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

WebView
InvokeScript

 

 

Show:
© 2015 Microsoft