jQuery hashchange event v1.2


I’ve just updated jQuery hashchange event to fix a bizarre bug in Safari. Apparently references to window.location become stale when pressing the back button from a page on another domain.

Of course, this broke the plugin for the one person who was doing this (thanks for the tip, Chris), but it’s now fixed, along with WebKit Bugzilla bug 34679 filed, and a few other miscellaneous things:

  • The IE6/7 Iframe is now inserted after the body (this actually works), which prevents the page from scrolling when the event is first bound.
  • The event can also now be bound before DOM ready, but it won’t be usable before then in IE6/7. Meaning: you can do it, but be warned!
  • The plugin is now unit-tested in jQuery 1.4.2pre, and everything works!

jQuery BBQ will be updated soon to incorporate these changes, but if you want them right now, you can just grab the hashchange event plugin!

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.