Skyedra commented on issue #420:
URL:
https://github.com/apache/cordova-plugin-inappbrowser/issues/420#issuecomment-1718705680
>
window['webkit'].messageHandlers['cordova_iab'].postMessage(JSON.stringify({'data':
'value'}))
The above solution will work on some devices (including my local one),
however, I found it failed on some devices like Pixel 4, Galaxy S7, Pixel 3, Z
Fold 4, etc.
> TypeError: Cannot read properties of undefined (reading 'messageHandlers')
[This solution](https://stackoverflow.com/a/75152197) (with slight
modification inspired by Leonavas strategy) appears to be more reliable (and
also doesn't throw an error in typescript):
```
const target = window['cordova_iab'] ??
window['webkit'].messageHandlers['cordova_iab'];
target.postMessage(JSON.stringify({'command': command}));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]