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: <iframe src="page.html#begin"></iframe>

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!

Please view the example page and WebKit Bugzilla Bug 32156 to see for yourself!

Post A Comment

  • Any of these HTML tags may be used for style: a, b, i, br, p, strong, em, pre, code.
  • Multi-line JavaScript code should be wrapped in <pre class="brush:js"></pre>
    (supported syntax highlighting brushes: js, css, php, plain, bash, ruby, html, xml)
  • Use &lt; instead of < and &gt; instead of > in the examples themselves.