- From: Ian Hickson <ian@hixie.ch>
- Date: Tue, 31 Jan 2012 20:30:12 +0000 (UTC)
On Mon, 28 Nov 2011, Seon-Wook Park wrote: > > I have recently tried using HTML5's pushState() and window.onpopstate > for my website. They do work and I quite like the functionalities. > > However, recently while working on a series of webpages which > incorporate iframe elements, I found that the altering of iframe > locations seemed to alter history as well. When having changed the 'src' > attributes of my iframes, I found that my browsing history became > flooded with entries from my current page. (Used browsers: Firefox, > Chrome) > > I understand that as mentioned in > http://dev.w3.org/html5/spec/Overview.html#history-notes, iframe history > is kept track of, but what puzzles me is why the default implementation, > (which I realise is a work-in-progress), has been done so that one > cannot alter these automatic pushState's or suppress them. > > In fact, I have a feeling that such entries into the browsing history > should not be exposed to the user by default. I realise that I am in no > way experienced enough to question the decisions which have been made, > but I find this default behaviour odd as it is preventing me from doing > two jobs at once: > 1. Control basic history > 2. Alter iframe attributes This simplest solution, assuming that you are only going to pages on the same site, is to use iframe.contentDocument.location.replace() to update the URL, rather than setting the src attribute. You can also just remove the <iframe> altogether and insert another one. At this point I doubt we can really change how iframes work with session history, there are too many sites that depend on it. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 31 January 2012 12:30:12 UTC