次の方法で共有


WebView.PostWebMessage(WebMessage, Uri) Method

Definition

Post a message to main frame.

[Android.Runtime.Register("postWebMessage", "(Landroid/webkit/WebMessage;Landroid/net/Uri;)V", "GetPostWebMessage_Landroid_webkit_WebMessage_Landroid_net_Uri_Handler", ApiSince=23)]
public virtual void PostWebMessage (Android.Webkit.WebMessage message, Android.Net.Uri targetOrigin);
[<Android.Runtime.Register("postWebMessage", "(Landroid/webkit/WebMessage;Landroid/net/Uri;)V", "GetPostWebMessage_Landroid_webkit_WebMessage_Landroid_net_Uri_Handler", ApiSince=23)>]
abstract member PostWebMessage : Android.Webkit.WebMessage * Android.Net.Uri -> unit
override this.PostWebMessage : Android.Webkit.WebMessage * Android.Net.Uri -> unit

Parameters

message
WebMessage

the WebMessage

targetOrigin
Uri

the target origin.

Attributes

Remarks

Post a message to main frame. The embedded application can restrict the messages to a certain target origin. See HTML5 spec for how target origin can be used.

A target origin can be set as a wildcard ("*"). However this is not recommended. See the page above for security issues.

Content loaded via #loadData(String,String,String) will not have a valid origin, and thus cannot be sent messages securely. If you need to send messages using this function, you should use #loadDataWithBaseURL(String,String,String,String,String) with a valid HTTP or HTTPS baseUrl to define a valid origin that can be used for messaging.

Java documentation for android.webkit.WebView.postWebMessage(android.webkit.WebMessage, android.net.Uri).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to