Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
160
rated 0 times [  162] [ 2]  / answers: 1 / hits: 39734  / 14 Years ago, thu, august 26, 2010, 12:00:00

If I open a dialog like so:



$('<iframe id=externalSite class=externalSite src=http://www.example.com />').dialog({
autoOpen: true,
width: 800,
height: 500,
modal: true,
resizable: true
})


How can I close the dialog from withing the iframe?


More From » jquery

 Answers
18

OK so I put the iframe on the page with display set to none. I open it like this:



$('#externalSite').dialog({ ... });


on the main parent window I have a function like this:



function closeIframe()
{
$('#externalSite').dialog('close');
return false;
}


From within the iframe I call:



window.parent.closeIframe();

[#95801] Tuesday, August 24, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
monetm

Total Points: 615
Total Questions: 103
Total Answers: 119

Location: Finland
Member since Fri, Oct 21, 2022
2 Years ago
monetm questions
Fri, Feb 26, 21, 00:00, 3 Years ago
Wed, Sep 9, 20, 00:00, 4 Years ago
Sun, Jul 26, 20, 00:00, 4 Years ago
Thu, Jun 11, 20, 00:00, 4 Years ago
;