Search code examples
javascripthtmlgoogle-chromemobile-safari

Window.parent and Window.top returning null


When I call window.parent and window.top from my iFrame both return null in Chrome and iPad safari, however they both work in Firefox.

A lot of similar posts say the solution is to put the iframe html file on a server, however mine is already on an Apache Tomcat instance and is accessed with localhost:...

There is no variable in the JavaScript which overrides the keywords parent or top.

Getting this to work in chrome isn't a big deal, I'm more concerned with iPad safari.

Any possible tips or solutions are greatly appreciated.


Solution

  • Based on the comments, you are in two different domains, and I am betting you have control over them.

    You can look into HTML5 post message so you can talk between the domains.