CoreWebView2Settings.IsWebMessageEnabled Property

Definition

Determines whether communication from the host to the top-level HTML document of the WebView is allowed.

public bool IsWebMessageEnabled { get; set; }
member this.IsWebMessageEnabled : bool with get, set
Public Property IsWebMessageEnabled As Boolean

Property Value

Boolean

Remarks

This is used when loading a new HTML document. If set to true, communication from the host to the top-level HTML document of the WebView is allowed using PostWebMessageAsJson(String), PostWebMessageAsString(String), and message event of window.chrome.webview. Communication from the top-level HTML document of the WebView to the host is allowed using window.chrome.webview.postMessage function and the WebMessageReceived event. If set to false, then communication is disallowed. PostWebMessageAsJson(String) and PostWebMessageAsString(String) fail and window.chrome.webview.postMessage fails by throwing an instance of an Error object. The default value is true.

Applies to

See also