Responding to an iframe close window command...?

8 posts, 1 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 03 Jul 2013 Link to this post

    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
  2. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 05 Jul 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 05 Jul 2013 Link to this post

    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.
  5. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 05 Jul 2013 Link to this post

    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!
  6. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 05 Jul 2013 Link to this post

    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
  7. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 08 Jul 2013 Link to this post

    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!
  8. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 08 Jul 2013 Link to this post

    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).
  9. Answer
    Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 08 Jul 2013 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready