WebView2.ExecuteScriptAsync(String) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Executes JavaScript code from the javaScript parameter in the current top level document rendered in the WebView. Equivalent to calling ExecuteScriptAsync(String).
public System.Threading.Tasks.Task<string> ExecuteScriptAsync (string javaScript);
member this.ExecuteScriptAsync : string -> System.Threading.Tasks.Task<string>
abstract member ExecuteScriptAsync : string -> System.Threading.Tasks.Task<string>
override this.ExecuteScriptAsync : string -> System.Threading.Tasks.Task<string>
Public Function ExecuteScriptAsync (javaScript As String) As Task(Of String)
- javaScript
- String
Thrown if CoreWebView2 hasn't been initialized yet, or if the calling thread isn't the thread which created this object (usually the UI thread). See VerifyAccess() for more info. May also be thrown if the browser process has crashed unexpectedly and left the control in an invalid state. We are considering throwing a different type of exception for this case in the future.
Thrown if Dispose(Boolean) has already been called on the control.