This is a migrated thread and some comments may be shown as answers.

Responding to an iframe close window command...?

7 Answers 1718 Views
Window
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 03 Jul 2013, 07:10 PM
Site had a popup window which was an iframe to a partner page.

That partner page has a "close" link which closes the popup window.

I instead loaded the url into a kendo window (clearly, looks way better)...but now the close doesn't work.

Is there some way to hook into it such that it'll close the kendo window?

**NOTE**
I do not have the ability to change the content in the iframe

7 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 05 Jul 2013, 08:32 AM
Hello Steve,

Please direct your attention to

http://docs.kendoui.com/getting-started/web/window/overview#accessing-an-existing-window

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 05 Jul 2013, 09:00 AM
So what part of that solves this?   i don't need to access an existing window, I need to hook into the close event being fired from the iframe. mI know how to reference my window once that happens.
0
Dimo
Telerik team
answered on 05 Jul 2013, 12:31 PM
Hi Steve,

I am afraid it was not clear what exactly you were trying to do and I got the wrong impression. 

I am still not sure what the link inside the iframe does, as there is no "close" event or method for iframes. In case the iframe is removed from the DOM, then you can use the DOMNodeRemoved event in the parent page. The code below shows how to check whether a Window iframe is triggering an event and how to obtain reference to the corresponding Window instance. You can use this information even if the desired implementation is different.

$(document).on("DOMNodeRemoved", function(e){
    var target = $(e.target);
    if (target.is(".k-content-frame")) {
        target.closest(".k-window-content").data("kendoWindow").close();
    }
});


Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 05 Jul 2013, 01:06 PM
Maybe if you saw it...we're still on the wrong page

http://dev.gourmetsleuth.com/recipes/detail/prickly-pear-margarita

Click "Add to recipe box" you'll see the thing popup in a kendo window (log in\create accout) .

When it's added, you'll see a screen like I have attached....notice the close button, does nothing (again, this is their page, their site...)

So if INSTEAD of a kendo window, if this page was loaded in an onclick="window.open(url)", that close button works and closes the popup window...this is the problem. :/


Steve
0
Dimo
Telerik team
answered on 08 Jul 2013, 09:14 AM
Hello Steve,

Thanks for the clarification.

Basically, the desired functionality and behavior in this case depends on the ability to attach a handler on an element inside an iframe from the parent page. I am not sure this is possible, as what I tried didn't work. The main requirement, however, is that the parent page and iframe page belong to the same domain. Obviously, this is not the case.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 08 Jul 2013, 01:59 PM
Can it not be done in reverse?  By that I mean they are already wiring up the code to code the window it thinks it's in.

Can I not listen for some sort of event in my browser and then close the kendo window (instead of trying to drill into the iframe).
0
Accepted
Dimo
Telerik team
answered on 08 Jul 2013, 02:08 PM
Hello Steve,

I guess I was not clear enough in my previous reply.

Any interaction between scripts from two pages (iframe and its parent) is impossible if the two pages belong to different domains.


If you succeed in implementing an acceptable algorithm and behavior with a simple <iframe>, but need help with integrating the Kendo UI Window in that scenario, then I will show you how to do it. 

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Window
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Dimo
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or