Message Listener Only Receives “{isTrusted: true}” Object

The webpage rendered inside webview only receives {isTrusted: true} when receiving events.

This issue can be reproduced by adding the following code to the webage that attaches a function to the message event:
window.addEventListener('message', this.handleMessage);

In the webview, I activate the message event using the injectJavaScript method like this this.webview.injectJavaScript(window.postMessage(${stringMessage}, ‘*’); true;)

where stringMessage is as JSON.stringified object

Expected behavior:
I expected the entire stringified object to be received as a variable in the handleMessage function. Instead, I only receive the {isTrusted: true}


1 thought on “Message Listener Only Receives “{isTrusted: true}” Object

Comments are closed.