close iframe that's in another domain
I'm using lytebox to open an iframe, but the iframe url is in another domain that the parent window.
the $lb.end(); starts lytebox scripts in parent window which close the iframe and modify all the css stuff.
That works when my iframe url is in the same domain. But when it's in another domain, that does'nt work.
Can anyone tells me how to do that ? Starting the $lb.end() function of the parent window ?
Originally Posted by piwozdiwect
simple. call top.postMessage() and raise an event on top that closes your box by sending a flag or trigger in your event.data argument.
Well, yes, but doesn't that require the access on both domains?
Originally Posted by rnd me
On the other hand, postMessage() won't work on IE7 (and other older browsers). And I think it works synchronously in IE9 (at least).
even without IE7, postMessage() is much better than "AFAIK, you can't."...
if the OP doesn't have access to both domains, he shouldn't be influencing code on both.
there are work-arounds for IE7, the window.name transport for example, but i would just focus on the current and last time's browsers.
"malicious" stems from "malice", which i don't think is a motivation in most of these requests. I think many coders, especially the newer ones that ask lots of questions around here, are just unaware of the SOP.
Originally Posted by Kor
i also think that hackers wouldn't ask many questions in public, or would know how to figure it out themselves. Otherwise, they wouldn't be a very good hacker...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread