History.js does not work in Internet Explorer

I am trying to get history.js to work in Internet Explorer because I need history.pushState () to work. I read the instructions on GitHub ( https://github.com/browserstate/History.js/ ) and tried to implement it, but havent been successful. Here is what i have

<!DOCTYPE html> <html> <head> <!-- jQuery --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <!-- History.js --> <script defer src="http://balupton.github.com/history.js/scripts/bundled/html4+html5/jquery.history.js"></script> <script type="text/javascript"> function addHistory(){ // Prepare var History = window.History; // Note: We are using a capital H instead of a lower h // Change our States History.pushState(null, null, "mylink.html"); } </script> </head> <body> <a href="mylink.html">My Link</a> <a href="otherlink.html">Other Link</a> <button onclick="addHistory()" type="button">Add History</button> </body> 

Not sure what I am doing wrong, but it definitely does not work in IE8 or IE9. It works in Firefox, but this could be because Firefox actually supports history.pushstate to start with. Any help is appreciated.

+7
source share
1 answer

In the second <script> remove the word defer .
because if you mention this word, it means a reprieve. (If you want to keep this in order to reduce the blocking of the page display, do not delete it). This is too IE very strict, so you have this problem. Hope this helps.

send this

+1
source

All Articles