Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11885

iframe message error

VotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      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,"*")

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            shazron Shazron Abdullah
            pierbover Pier Bover
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment