Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-27-2011, 04:27 PM   PM User | #1
piwozdiwect
New to the CF scene

 
Join Date: Nov 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
piwozdiwect is an unknown quantity at this point
close iframe that's in another domain

Hello

I'm using lytebox to open an iframe, but the iframe url is in another domain that the parent window.

i need to close the iframe when user clicks a button. I can do that with javascript : top.$lb.end();
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 ?
Thank you.
piwozdiwect is offline   Reply With Quote
Old 11-27-2011, 05:00 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,033
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
<iframe>'s which display content from different domains have security measures in place to prevent all sorts of evil consequences.

So for security reasons JavaScript cannot access anything beyond the domain of the current page. This is known as the "same origin policy" and prevents a document or script loaded from one origin from getting or setting properties of a document from a different origin.

So I don't think that what you want is possible.

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Reply

Bookmarks

Tags
domain, iframe, javascript

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:43 AM.


Advertisement
Log in to turn off these ads.