Share via


WebView2.ExecuteScriptAsync(String) Method

Definition

Asynchronously executes the provided script in the top level document of the WebView2.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

public:
 virtual IAsyncOperation<Platform::String ^> ^ ExecuteScriptAsync(Platform::String ^ javascriptCode) = ExecuteScriptAsync;
IAsyncOperation<winrt::hstring> ExecuteScriptAsync(winrt::hstring const& javascriptCode);
public IAsyncOperation<string> ExecuteScriptAsync(string javascriptCode);
Public Function ExecuteScriptAsync (javascriptCode As String) As IAsyncOperation(Of String)

Parameters

javascriptCode
String

Platform::String

winrt::hstring

The script to execute.

Returns

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

A Task that represents the script execution process.

Applies to