Compartilhar via


CoreWebView2WebMessageReceivedEventArgs.TryGetWebMessageAsString Method

Definition

Gets the message posted from the WebView content to the host as a string. The message posted from the WebView content to the host.The message posted is some other kind of JavaScript type.

public string TryGetWebMessageAsString ();
member this.TryGetWebMessageAsString : unit -> string
Public Function TryGetWebMessageAsString () As String

Returns

The message posted from the WebView content to the host.

Exceptions

The message posted is some other kind of JavaScript type.

Examples

For example the following postMessage runs result in the following values returned by TryWebMessageAsString:

postMessage({'a': 'b'})      ArgumentException
postMessage(1.2)             ArgumentException
postMessage('example')       "example"

Remarks

Run this operation to communicate using simple strings.

Applies to