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.
What the exact domain name structure you are using?
If you are using mydomain.localhost, you are unable to use .localhost as a shared part of domain name, since it is 1st level doman.
If you are using mydomain.localhost.com , then shared part (document.domain) should be “localhost.com” , not just “localhost” as you mentioned in your question.
document.domain should work fine for that purpose, but even if you have two different domains, like company1.com and company2.com it is still possible to pass values from iframe to parent with help of EasyXDM .