W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2012

[whatwg] The so-called 'magic iframe' feature

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 22 Jun 2012 20:55:24 +0000 (UTC)
To: whatwg <whatwg@lists.whatwg.org>
Message-ID: <Pine.LNX.4.64.1206222048070.30734@ps20323.dreamhostps.com>
On Thu, 26 Jan 2012, Andrew Oakley wrote:
> > 
> > <iframe> outside a document doesn't initiate a load, so it's case is 
> > different.
> 
> I'm not sure it is - we can create an <iframe> in the document then 
> remove it before it loads.  Most browsers seem to give up on loading the 
> contents of the iframe if you do this (IE continues to delay the load 
> event until it has loaded the iframe).
> 
> As far as I can tell HTML5 says that you shouldn't do anything when an 
> iframe is removed from a document (and therefore the frame should 
> continue to load and delay the load event, assuming it isn't GC'd).
> 
> I think we should be consistent here - if we continue to delay the load 
> events for <img>, <video> and <audio> after they have been removed from 
> the tree then the same should be true for <iframe>.

On Thu, 12 Apr 2012, Ojan Vafai wrote:
>
> We should add a keepalive attribute to iframes that prevents iframes 
> from being unloaded/reloaded when removed from or appended to a 
> document. Similarly, a disconnected iframe with keepalive should load. 
> If the keepalive attribute is removed from a disconnected iframe, then 
> it should unload.
> 
> I'm not terribly happy with the name 'keepalive', but I can't think of 
> anything better at the moment.
> 
> As iframes increasingly become the standard way of achieving certain 
> tasks (e.g. sandboxing), it's increasingly important to be able to move 
> them around in the DOM. Right now, to achieve this sort of keepalive 
> behavior, you have to keep the iframe always appended to the document 
> and position it absolutely as the document changes.

On Thu, 12 Apr 2012, Adam Barth wrote:
>
> We just got finished removing this feature from WebKit because it caused 
> many security and stability problems.  It turns out that there's a lot 
> of code in browsers that can't cope with a disconnected iframe being 
> alive.

I've changed the spec to make removing an iframe from a document cause the 
nested browsing context to be discarded. (This includes when a node is 
moved from one place in the DOM to another.)


On Mon, 16 Apr 2012, Darin Fisher wrote:
>
> Can you hide this behind adoptNode just as we did for "magic iframe"?  
> The nice thing about adoptNode is that the browser gets told both the 
> source and destination parent nodes.  This way there is never a 
> disconnected state.
> 
> So long as we unload when moving between documents, we should be pretty 
> safe as far as the issues which plagued magic iframe are concerned.

On Mon, 16 Apr 2012, Erik Arvidsson wrote:
>
> FWIW, IE used to not reload iframes when they were moved around in the 
> tree. They changed this behavior in IE9 so maybe there was some compat 
> issues?

I couldn't find a browser that let iframes survive even being moved around 
the same document. (I was unable to test Opera or IE, though.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 22 June 2012 20:55:59 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:43 UTC