slack-digest/2021-12-23.md
Thu, 23 Dec 2021 08:21:30 GMT
Join the conversation at slack.cordova.io
Wed, 22 Dec 2021 13:14:16 GMT
@moritz.eck says
cordova-plugin-inappbrowser: postMessage API I have a question regarding the
cordova-plugin-inappbrowserand hope that someone in this channel has experience with it. The postMessage API has been implemented (https://github.com/apache/cordova-plugin-inappbrowser/pull/362|#362) and is documented here: https://github.com/apache/cordova-plugin-inappbrowserWhat have I tried to do? I was only able to find documentation for the direction from inside the inAppBrowser window to the context running the inAppBrowser - most of the case the native/cordova app (i.e. inside -> outside). Is it also possible to send a message from the outside to the inside. Basically, in the same direction that
executeScript()andinjectCSS()work.What would I like to achieve? Currently, I’m launch the inAppBrowser, navigate to a specific URL which is also under my control on which I have registered an event handler
window.addEventListener("message",...). Now, I would like to post a message from the app code to the inAppBrowser instance (i.e. the browser window that is on this specific url) once an event happens on the native device. Is this possible?I would be happy to contribute back and improve the official documentation if we managed to find an answer to the question. Thanks!