Wil*_*lic 7 html javascript jquery history.js pushstate
我试图让history.js在Internet Explorer中工作,因为我需要history.pushState()才能工作.我已经阅读了GitHub(https://github.com/browserstate/History.js/)上的说明并试图实现它,但没有取得任何成功.这就是我所拥有的
<!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>
Run Code Online (Sandbox Code Playgroud)
不知道我做错了什么,但它肯定不适用于IE8或IE9.它确实可以在Firefox中运行,但这可能是因为Firefox实际上支持history.pushstate.任何帮助表示赞赏