Passing JS variable from child Iframe to parent JSP on cross sub domain

Posted by Tarun on Stack Overflow See other posts from Stack Overflow or by Tarun
Published on 2012-08-29T21:11:29Z Indexed on 2012/08/29 21:38 UTC
Read the original article Hit count: 203

I am stuck at 1 location and need some help. I created two subdomains on apache tomcat server like domain1.localhost.com and domain2.localhost.com in server.xml. On domain1 I have a JSP that includes iFrame (hosted on domain2). How can we pass the JS variable from child Iframe to parent JSP and store it in local variable of JSP hosted on domain1.localhost.com?

I tried defining document.domain = "localhost" on both JSP but didn't work. Even parent DOM window is also not available in child iFrame (on sub-domain) because of obvious cross domain policies.

Any help would be highly appreciated.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about localhost