Don't use .load() to load an iframe.  Just set the iframe object's src 
property and the browser will do it for you.

<iframe id='foo' width="300px" height="300px"></iframe>

$('#foo').attr('src', 'myurl');

I did that extensively on http://www.imamuseum.org/.  Actually what I did 
there was have an iframe inside of a div, and the div would get hidden or 
shown by jQuery at the same time that I set the src.  That way I 
could "remove" the iframe whenever I wanted by just hide()ing its wrapping 
div.

On Monday 15 October 2007, Duncan Anker wrote:
> I am attempting to create preview panes on a page which need to have
> their own separate stylesheets, and as such need to be loaded as
> external documents (or at least, I can't think of another way to do it).
>
> I have set up a couple of iframes -- ideally I'd sooner use objects to
> stay strict, however they seem like a nasty and even more opaque data
> structure -- and have tried a few methods to get the data to show up. As
> far as I can tell, the load call works fine, firebug shows the post and
> response, however there is no joy.
>
> I wouldn't have thought it would be a cross-domain problem since they
> should be loading from the same server, however I have also tried
> dynamically creating the iframes just in case.
>
> This works when #preview is a div:
>
> $('#preview').load('myurl', data);
>
> but it stuffs up the CSS. It does not work, and neither it should, if
> #preview is an iframe. However, I thought something like
>
> $('body[0]', $('#preview')).load('myurl', data);
>
> might do the trick. It didn't of course.
>
> Thus far there is no combination of jQuery and regular DOM scripting
> that has yielded positive results, and I'm beginning to wonder if it is
> all some kind of extremely long-running April Fools' prank.
>
> There's got to be some simple way to do this, so what am I overlooking?
>
> TIA


-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

Reply via email to