In our cordova/phonegap-app we're using an iFrame to load external websites. To communicate with the iFrame-content I've created a script for both sites (App and Website) which uses iFrame.contentWindow.postMessage()-method. The reason is to open external links within the iframe in the system-browser of the smartphone. This solution worked fine on cordova 2.3.0.
Today I've updated the cordova version of the app to 3.1.0 and deleted some permissions from android-manifest. But the communication with the iFrame-content doesn't work. Following error error-message is shown:
"Unable to post message to https://[domain]. Recipient has origin file://"
To post a message to the IFrame I use following code:
$('#webViewIFrame').get(0).contentWindow.postMessage('message', host);
Has anybody an idea why my communication-solution doesn't work with cordova 3.1.0?
Normally this should be because of cross domain problem. Try using this: