Filing this under the either the I Can\'t Believe No One Noticed This Before or the I Must Be Missing Something categories:
It appears that if you do a simple
Works fine for me when using: https://github.com/browserstate/history.js - this also fixes many other cross browser bugs with the HTML5 History API.
As of v1.7, here are the bugs it solves:
- History.js solves the following browser bugs:
- HTML5 Browsers
- Chrome 8 sometimes does not contain the correct state data when traversing back to the initial state
- Safari 5, Safari iOS 4 and Firefox 3 and 4 do not fire the
onhashchangeevent when the page is loaded with a hash- Safari 5 and Safari iOS 4 do not fire the
onpopstateevent when the hash has changed unlike the other browsers- Safari 5 and Safari iOS 4 fail to return to the correct state once a hash is replaced by a
replaceStatecall / bug report- Safari 5 and Safari iOS 4 sometimes fail to apply the state change under busy conditions / bug report
- Google Chrome 8,9,10 and Firefox 4 prior to the RC will always fire
onpopstateonce the page has loaded / change recommendation- Safari iOS 4.0, 4.1, 4.2 have a working HTML5 History API - although the actual back buttons of the browsers do not work, therefore we treat them as HTML4 browsers
- None of the HTML5 browsers actually utilise the
titleargument to thepushStateandreplaceStatecalls- HTML4 Browsers
- Old browsers like MSIE 6,7 and Firefox 2 do not have a
onhashchangeevent- MSIE 6 and 7 sometimes do not apply a hash even it was told to (requiring a second call to the apply function)
- Non-Opera HTML4 browsers sometimes do not apply the hash when the hash is not
urlencoded- All Browsers
- State data and titles do not persist once the site is left and then returned (includes page refreshes)
- State titles are never applied to the
document.title