My application engine runs inside a WebView. It spans different IFRAMES.
Both the main application html and the iframes html are on android_assets.
On Android 3.x no problems ever. Same on chrome browser, etc.
If I create an IFRAME (createElement -> appendChild) the iframe is created.
When I load stuff in it (iframe.src=”url” <> iframe.contentWindow.location.href=”url”) … IT REPLACES THE MAIN APPLICATION!! (instead of loading into iframe)
Already tried:
- window.setTimeout to delay the loading… failed.
- in webview, inject X-Frame-Options=SAME_ORIGIN as header into any loaded page -> failed
- creating the iframe, setting sandbox=same_origin,allow_scripts -> failed
Anybody with similar problems? Or can someone help me find documentation about WebView ICS bugs vs Honeycomb?
Also found many other strange issues… is ICS really this buggy? :S :S
Sirs, I had the same problem when using Phonegap (Apache Cordova) and IFrames in Android Ice Cream Sandwich (4.0.3).
To solve this problem, I had to edit Apache Cordova Source Code. I changed the org.apache.cordova.CordovaWebViewClient.java file, and commented this part of the code, and included the last line (return false;).
So it now looks like this:
This problem only happens on Android ICS, but I changed the code for all my apps. I’m still doing tests.
In my analysis, it seems that when you try to load a page inside a iFrame, the Android WebView on ICS interprets it as a new page request, and IT REPLACES THE MAIN APPLICATION!!, or in other words, it OPENS the requested page in the hole parent window.
I left the rest of the code untouched.
I hope it helps, like it did for me.
Best regards.
Alexandre Almeida