AsyncExecute Method  
 

Executes the specified script or command asynchronously in the context of the current document.

Syntax

object.AsyncExecute( JavaScript )

Parameters

JavaScript
A string which specifies the JavaScript that should be executed in the context of the current page being viewed.

Return Value

Returns True if the method succeeds or False if the method fails.

Remarks

The AsyncExecute method evaluates a JavaScript expression within the context of the currently loaded page and returns the result asynchronously. Unlike Execute, this method does not block while waiting for the script to complete. Instead, the result is delivered through the ScriptCompleted event.

The script must be valid JavaScript and should not assume synchronous execution. Results are returned in the event handler which will provide you with the response in JSON-encoded form; for example, string values will be quoted. Because script execution is dispatched to the underlying WebView2 control, this function will fail if navigation is still in progress. Applications should always wait for the NavigationCompleted event before invoking script execution.

See Also

Execute Method, NavigationCompleted Event, ScriptCompleted Event