-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Post Message Support on WebGL for Cross-Origin Comms #1088
Comments
I pushed a modified sample app to introduce postMessage: https://github.com/gree/unity-webview/commits/example-for-1088/ As we can see in 40aba92, postMessage requires addEventListener in the iframe content, so it is not a complete alternative. Anyway, as shown here, adding postMessage is easy and might be adequate if you can edit the iframe content. |
looks pretty good, will test this out edit: so from what I understand, we'll still need separate logic to handle messages received/it won't trigger the callback in webviewObject.init callback? |
Yes, so I wrote "not a complete alternative." |
Sorry that the last comment was a bit too brief and didn't answer about the callback specifically. I've further updated the branch so that it can be directly utilized. Could you please check the latest. |
Currently, the only way to communicate with the webview on WebGL, is using EvaluateJS
This is problematic, because running
.eval
on the iframe that the webview creates, is blocked by browser when applied on cross-origin frames.A safe and common way to get around this is to post messages to the iframe instead.
It would be great for the WebGL version to have support for post message, so that communication between game and cross-origin frames can occur
The text was updated successfully, but these errors were encountered: