简体   繁体   English

使用History.js时收到错误

[英]Receiving error when using History.js

I'm implementing History.js into my web application as a workaround for the lack of support for history.pushState() in Internet Explorer. 我正在将我的Web应用程序中实现History.js作为一种变通办法,以解决Internet Explorer中对history.pushState()缺乏支持的问题。

So far, following demos & tutorials I've written the following code: 到目前为止,在演示和教程之后,我编写了以下代码:

var historyJs = window.History;

historyJs.Adapter.bind(window, 'statechange', function () {
     var State = History.getState();
     historyJs.log(State.data, State.title, State.url);
});

However, I'm getting the following error returned in Internet Explorer 9: 但是,我在Internet Explorer 9中收到以下错误消息:

SCRIPT5007: Object expected SCRIPT5007:预期对象

jquery.history.js, line 1 character 3154 jquery.history.js,第1行字符3154

在此处输入图片说明

Why am I receiving this error? 为什么会收到此错误?

听起来您好像缺少对jQuery的引用。

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM