I have a site with anchor navigation (like gmail, when the anchor value changes a new content for a page is loaded with ajax). In Firefox, when I change the anchor (with js or with a page) a new item in the history is created and works perfectly. But in IE6 it doesn’t stores this new item and the back button doesn’t work as expected.
Is there anyway to add this new item using javascript?
This is possible because gmail does it but I don’t know how it does it.
I’ve done a lot of work with history and using the hash. Almost all of the existing history plugins have some sort of gap in them. The one I’ve used that’s pretty close to perfect is this one which is a jQuery plugin:
http://www.mikage.to/jquery/jquery.history.js
It was updated in March of this year handles IE 8 issues and it also deals with IE6 pretty successfully. One thing I’ve noticed is that IE really hates having ? in the hash after the #. It stops properly handling the hash when the ? is present. Even this one I think needs a little patch for the ?, I really need to send that along to Mikage. The way to handle this is instead of using
location.hashin the plugin when referencing the hash, use this function:So in those spots where you need the hash, pass
locationthe to function……instead of using location.href. But note that for IE, because it’s using the iframe, you want to use iframe.location instead.
Yahoo’s Bug
You can see that Yahoo doesn’t gracefully handle ?’s in IE when looking at this URL:
http://developer.yahoo.com/yui/examples/history/history-tabview.html#tabview=tab1?7236471234
It should just ignore the non-existent module, (which it does for other names which have no ?’s in them). But it raises a JavaScript error when a ? is in the URL.
(I will extend this list in a moment)
Really Simply History
Frankly, it’s primary issue seems to be it’s gone dormant. I’ve experienced this issue and just didn’t want to dig through it: