Answer the question
In order to leave comments, you need to log in
IE8 bug in History.js (cross browser solution for ajax history)
Are there people here who used this? :)
In IE8 (at least) there is a bug: when clicking on a link (in the handler of which History.pushState is specified), statechange does not work, and window.location changes (#anchor changes in IE8) - and only once. If you refresh the page, then the statechange event fires.
I tried to do the same when clicking on the link History.Adapter.trigger (window, "anchorchange") - it only helps with the first click on the link. All further clicks are stubbornly not processed (to the point that #anchor itself does not even change anymore).
Also, if you put IE in "IE8/7 Standards Compliance Mode", then the plugin starts working normally.
Sample code:
(function(window,undefined){
// history module
var History = window.History; // do not forget to use "H", instead of "h"
if ( !History.enabled ) {
return false;
}
// Note: We are using statechange instead of popstate
History.Adapter.bind(window,'statechange',function(){
// we are using History.getState() instead of event.state
var State = History.getState();
var url = State.url;
// History.log(State.data, State.title, State.url);
loadPage(url);
});
})(window);
$(document).ready(function() {
$("#bottom_nav a").click(function(event){
var url = $(this).attr("href") + '?format=html';
History.pushState(null, null, url);
event.preventDefault();
return false;
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question