WebKit bug: hash history + Iframe = fail
I recently encountered an odd behavior in WebKit while testing jQuery BBQ on a page that lived in an Iframe. What I initially thought might be a bug in jQuery BBQ actually appears to be a bug in Webkit, so I set up an example page that shows how location.hash browser history breaks in an Iframe, in WebKit, Safari, and Chrome.
To make a long story short, when the location.hash is changed in a document loaded in an Iframe, history entries are not always created correctly.
For example, given an Iframe like this:
If that page.html location.hash is then set to #middle and #end, when the back button is pressed, #middle can be reached, but #begin cannot. That’s in the latest WebKit nightly.. in the current Safari and Chrome, no history is created whatsoever!