balupton/history.js — Issue #129: 'onanchorchange' doesn't seem to trigger hashchange event (FF3.6)?
Author: Integralist
Created: 2011-11-23 11:53:31+00:00
State: open

I've created a repo which demonstrates this issue: https://github.com/Integralist/Mobile-Framework/tree/Zepto

I'm testing this on Firefox 3.6 (mainly because it doesn't support HTML5 pushState, so I'm guessing you could try this code with any other browser as long as it also doesn't support HTML5 pushState)

If I load up the page zepto.html and then click on the left button titled 'Button (loads zepto2.html)' then this will execute an ajax request to load the relevant content from the target page and insert it into the current page. After which the script then updates the state of the page using `History.pushState`.

The problem is that I have an `onanchorchange` listener set-up which doesn't appear to be firing when the hash in the url is changed to reflect the new state.

So for example, after the new content is loaded the url changes to: `http://mobile:8888/zepto.html#zepto2.html?&_suid=1322048749836016722274532139614` so I'm assuming the `onanchorchange` event should be triggered at that point?

Any ideas?

Kind regards,
Mark