History.js not working in Internet Explorer

Posted by Wilcoholic on Stack Overflow See other posts from Stack Overflow or by Wilcoholic
Published on 2012-07-05T21:13:42Z Indexed on 2012/07/05 21:15 UTC
Read the original article Hit count: 181

Filed under:
|
|
|
|

I am trying to get history.js to work in Internet Explorer because I need history.pushState() to work. I have read over the instructions on GitHub (https://github.com/balupton/History.js/) and have tried implementing it, but havent had any success. Here's 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'm doing wrong, but it's definitely not working in IE. Any help is appreciated

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery