LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   javascript - chrome: problem with iframe's parent (https://www.linuxquestions.org/questions/programming-9/javascript-chrome-problem-with-iframes-parent-4175415923/)

eantoranz 07-10-2012 10:30 AM

javascript - chrome: problem with iframe's parent
 
Hi!

I'm developing an application on phonegap and running it on android. I want to send a meesage to a page from a double-nested iframe.

On Android 2.2 it works if I do this:

Code:

parent.parent.postMessage('whatever', '*');
But then I try on Android 4 and it doesn't work.... I checked with javascript the location of each "parent" and on Android 4 it always returns the same address of the iframe I'm trying to send the message from and in 2.2 it returns the "right" address of each iframe. Why is that?

eantoranz 07-10-2012 10:38 AM

I just performed a very simple test. I tested if window == parent. On 2.2 it's not the same... on 4.0 it is the same. Does it make any sense?

eantoranz 07-10-2012 10:43 AM

How interesting:

http://productforums.google.com/foru...me/KXWxXF6RJZY

Is it because a phonegap application runs locally? Ugh! Is there a workaround for this?

eantoranz 07-10-2012 11:16 AM

I had tried a very small application with an iframe that sent a message to its parent. I tested it running in apache from android's browser and it works. I just tested it from inside phonegap and it fails.... so I guess "running locally" is to blame here. So.... is there a workaround? perhaps changing something in the manifest?


All times are GMT -5. The time now is 06:21 PM.