You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Pier Bover (JIRA)" <ji...@apache.org> on 2016/09/22 03:39:20 UTC

[jira] [Comment Edited] (CB-11885) iframe message error

    [ https://issues.apache.org/jira/browse/CB-11885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15512002#comment-15512002 ] 

Pier Bover edited comment on CB-11885 at 9/22/16 3:38 AM:
----------------------------------------------------------

I have created this simple project that reproduces the error:
https://github.com/PierBover/cordova-wkwebview-iframe-bug

To reproduce:
1) go to the {{cordova}} folder
2) {{cordova emulate ios --target="iPad-Air-2, 9.3"}}
3) Open Safari. On the Developer menu open the JS console for the webview.
4) Click the buttons on the webview.


was (Author: pierbover):
I have created this simple project that reproduces the error:
https://github.com/PierBover/cordova-wkwebview-iframe-bug

To reproduce:
1) go to the {{cordova}} folder
2) {{cordova emulate ios --target=\"iPad-Air-2, 9.3\"}}
3) Open Safari. On the Developer menu open the JS console for the webview.
4) Click the buttons on the webview.

> iframe message error
> --------------------
>
>                 Key: CB-11885
>                 URL: https://issues.apache.org/jira/browse/CB-11885
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin WKWebViewEngine
>    Affects Versions: 4.2.1
>         Environment: iOS 9
>            Reporter: Pier Bover
>            Assignee: Shazron Abdullah
>
> When trying to communicate between an iframe and the main window using Window.postMessage() I get the error:
> {{Blocked a frame with origin "null" from accessing a frame with origin "null"}}
> This only happens from the iframe to the main window, when communicating the other way around it works fine.
> Both files are run locally. The error only happens after adding the plugin {{cordova-plugin-wkwebview-engine}}. When using UIWebView the error does not happen.
> The weird thing is that this error is shown exactly 11 times, but the message goes through anyway. See this screenshot taken from Safari while using the simulator: http://i.imgur.com/JJkIEy5.jpg You can see the MessageEvent happening at the end.
> I have added {{sandbox="allow-same-origin allow-scripts allow-popups allow-forms"}} to the iframe tag but it didn't fix it.
> This is the code that listens to the message:
> {{window.addEventListener("message", eventHandler, false);}}
> And this is the code that emits the message from the iframe:
> {{parent.postMessage(something,"*")}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org