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

Why is a window in an iframe?

8 Answers 415 Views
Window
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 14 Feb 2012, 11:35 PM
Hi,

We use jQuery very much, and rely on many of the features as well as plugins that make life easy.
One of the plugins we use a lot is livequery.  this plugin allows us to do modifications on elements that are being added to the DOM after the page was already loaded, by AJAX for instance.

Example code:
$('h1,h2,h2 a,h3,h5,h6:not(.fx-cufon)').livequery(function() {
        $(this).addClass('fx-cufon');
        Cufon.replace($(this), { fontFamily: 'Decker', hover:true });
    });

As I'm sure you can read yourself, this bit of code says "each time you find a new h1 tag which is added to the dom, and which does not yet have the classname fx-cufon assigned to it, add the class name (to indicate this element has been processed already), and replace the tag with its Cufon font.

This works really great, and I can recommend anyone doing so, as I never need to think about newly added items; in fact this enables me to write grid initialisation code just once, and initialise it everytime I load a <div> with a specifica class...

Now my question.  I noticed this was no longer working when we migrated from jQueryUI dialogs to the KendoUI Window widget.  Digging into the code, I noticed that your window put the page in an iFrame (??!!??) which in my opinion isn't a nice solution really, as that means that the code is NOT being added to the DOM.

I found a configuration "iframe" in the documentation which I set to false, but that test didn't being a solution that helped me out. (I still got iframes as a result...)


I'm sure I can work around this by loading the ajax content myself, adding it to a newly created div, and popup the window from that div, but I don't think that should be the way we should be adding.

Is there a reason why you use iframes?  It just doesn't make sense to me to be honest.

8 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 14 Feb 2012, 11:37 PM
To add to this, and be completely honest - I'm even more convinced iframes should be avoided as this doesn't even get css from the main window applied!!
0
David
Top achievements
Rank 1
answered on 15 Feb 2012, 10:24 AM
Just to add even more info: the content we're loading is a relative path, so it's not cross-domain, and should not require an iframe...
0
Alex Gyoshev
Telerik team
answered on 15 Feb 2012, 02:21 PM
The window supports loading its content either through AJAX or through an iframe, if one cannot use AJAX. We have always recommended using the AJAX approach, as it is lightweight, but the iframe has its uses, such as loading cross-domain pages.

Regarding the issue that the window always loads the content in an iframe -- we have not observed that in the online demos. If you still experience the issue, please submit a working sample that shows the problem.

Greetings,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 15 Feb 2012, 02:27 PM
Alex,

thanks for the reply.
I just did some more research, and unfortunately it looks that our module responsible for rewriting the URLs is in fact pre-pending the urls with the http://DOMAIN.com/ prefix automatically.  this was a features we recently introduced because we had to support multiple domain names.

So it looks as if it ALWAYS loads using an iframe if you have an entire url, even if you set iframe to false as a parameter.

Is this perhaps the bug I stumbled upon?
0
David
Top achievements
Rank 1
answered on 15 Feb 2012, 02:28 PM
to be completed - this is NOT cross-domain; the http://domain.com was the same domain name...
0
Alex Gyoshev
Telerik team
answered on 16 Feb 2012, 05:17 PM
Hello David,

Indeed, our cross-domain check is rather silly right now. We'll be updating that to a more thorough check (rather than checking whether the URL starts with a protocol) -- until this gets fixed, please use the iframe configuration option to indicate that you don't want the contents rendered in an iframe, like so:

$("<div />").kendoWindow({
    content: "http://domain.com/content/ajaxContent.html",
    iframe: false
});

That works according to my tests -- be sure to use the service pack build to take advantage of the property.

Regards,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Joshua
Top achievements
Rank 1
answered on 24 Apr 2012, 01:06 AM
I am having the exact opposite issue. I cannot get iframes to actually work. I would like to open a print dialog that has a drastically different css and i do not want it to effect my original css.
0
Neo Wong
Top achievements
Rank 1
answered on 06 Jun 2012, 02:08 AM
Hello Alex  

I use this setting "iframe: false " to disable window load in iframe, but I still find the iframe appear. How can I solve this problem  ? it's the  service pack issues , which  service pack I should download ?

Neo

Tags
Window
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Joshua
Top achievements
Rank 1
Neo Wong
Top achievements
Rank 1
Share this question
or