WebViewCompat.WebMessageListener
public
static
interface
WebViewCompat.WebMessageListener
androidx.webkit.WebViewCompat.WebMessageListener |
This listener receives messages sent on the JavaScript object which was injected by WebViewCompat.addWebMessageListener(WebView, String, Set, WebViewCompat.WebMessageListener)
.
Summary
Public methods | |
---|---|
abstract
void
|
onPostMessage(WebView view, WebMessageCompat message, Uri sourceOrigin, boolean isMainFrame, JavaScriptReplyProxy replyProxy)
Receives a message sent by a |
Public methods
onPostMessage
public abstract void onPostMessage (WebView view, WebMessageCompat message, Uri sourceOrigin, boolean isMainFrame, JavaScriptReplyProxy replyProxy)
Receives a message sent by a postMessage()
on the injected JavaScript object.
Note that when the frame is file:
or content:
origin, the value of
sourceOrigin
is a string "null"
. However we highly recommend to not use
file:
or content:
URLs, see WebViewAssetLoader
for serving local
content under http:
or https:
domain.
Parameters | |
---|---|
view |
WebView : The WebView containing the frame which sent this message. |
message |
WebMessageCompat : The message from JavaScript. |
sourceOrigin |
Uri : The origin of the frame that the message is from. |
isMainFrame |
boolean : true If the message is from the main frame. |
replyProxy |
JavaScriptReplyProxy : Used to reply back to the JavaScript object.
|