Issue 3: Close button for modal dialog with iframe content
Status:  WontFix
Owner: ----
Closed:  Apr 2010
Reported by vs...@cal.berkeley.edu, Apr 15, 2008
If you are loading iframe content in the nyroModal window and have set 
modal to be true, I believe the close button html should still be written 
to the outer window. Because you are in an iframe, you no longer have 
access to the main page to create a 'close' link.
Apr 15, 2008
Project Member #1 nyro...@gmail.com
That's a good idea, but the iframe content can still close the nyroModal.

I made a test and put it in the demo section.

<a href="#" onclick="parent.$.nyroModalRemove(); return false;">Close From Iframe</a>

You can test it with the second iframe opening.

I'd like to let the developper to be totally free and have a full control of what
nyroModal shown. If the developper set modal: true, he should know what he's doing.
Apr 15, 2008
Project Member #2 nyro...@gmail.com
(No comment was entered for this change.)
Labels: -Type-Defect Type-Other
May 16, 2008
#3 maxim.sl...@gmail.com
Hey, and what about crossdomain issues? What if I load Iframe from different host? 
I'm pretty sure you will get Access denied error trying to access parent object 
Jun 3, 2008
Project Member #4 nyro...@gmail.com
You're right Maxim, a security error is thrown when trying to do that.

I've no idea how we could do that in a cross domain perspective. If you have any
idea, I'll try.
Jun 5, 2008
#5 maxim.sl...@gmail.com
I know there is one way to interact between iframes in different domains. You can 
change parent location, but only by adding "#xxxxxx" part to it. Important thing you 
must know parent URL in the Iframe or transfer it to Iframe in query string. Because 
trying to check value of parent.location.href will give you security warning...

Something like that:
1. Create iframe with src=sIframeHref+"?ParentUrl="+escape(document.location.href);
2. In the Iframe add the follwing action to close button:
parent.location = RequestQueryParam("ParentUrl") + "#closeMe"; 
The above line will NOT give you security error.
Now in the parent window check location every X miliseconds and close modal 
if "#closeMe" was found.I have this implemented in one of my sites...


Jun 5, 2008
Project Member #6 nyro...@gmail.com
Wouch, sounds like a hack...

The only thing I don't like in this solution is the checking every "X miliseconds".

Do you know a way to triger an event or anything from the iframe to let know the
parent that it should close the modal?
Feb 24, 2009
#7 leeked
I also need to set modal=true but want the close button to stay.
Why not make an extra setting, like modelShowClose, if model=true, check the
modelShowClose setting and if it is also true, show the close button.

Otherwise, show it as it does now...
Apr 15, 2009
#8 luciano....@gmail.com
Or use parent.$.nyroModalRemove(); in function.
May 28, 2009
#9 haluza...@gmail.com
I solved showing close button in iframe with css = Absolute Positioning.

Aug 18, 2009
#10 letgomye...@gmail.com
 I loading iframe content in the nyroModal window and have set modal to be true, 
The iframe content:

	<div class="error">已经访谈在直播列表里,无法直播。<a href="javascript:void(0)" 
class="nyroModalClose">关闭</a></div>


when i click the close link,the nyroModal window cann't close.   
onclick="parent.$.nyroModalRemove();  can close the nyroModal window 

happy
Apr 16, 2010
Project Member #11 nyro...@gmail.com
(No comment was entered for this change.)
Status: WontFix
Jun 30, 2011
#12 cfu...@gmail.com
well, you can still use a simple link:
<a href="parentPage.html" target="_parent">Close Window</a>
and the iframe will disappear. you just won't get the fading effect.