【发布时间】:2013-02-01 03:59:49
【问题描述】:
我正在使用 HTML 5 项目模板制作一个 Windows 8 Phone 应用程序。
我已经使用 nuget 下载了 jquery-1.9.1.js,还从 here 下载了 jquery.mobile-1.2.0.js 并添加了它们到我的项目。
现在我正在使用以下代码,我正在尝试使用localStorage,我的以下代码适用于 Chrome 和 Firefox,但不适用于 IE 10。
Common.js
$(document).ready(function(){
alert("jquery started");
localStorage.selectedCategory = "cc";
alert("After assignment");
alert(localStorage.selectedCategory);
})
当我在 IE 10 中运行此程序时,我在控制台中收到以下错误消息,并且仅显示我的第一个警报“jquery 已启动”,其余警报未显示。
SCRIPT5007:无法获取未定义或空引用的属性“msie” jquery.mobile-1.2.0.js,第 2536 行字符 5
SCRIPT5007:无法设置未定义或空引用的属性“selectedCategory” common.js,第 3 行字符 2
在我注释掉 localStorage 代码的那一刻,所有警报都会显示出来,但控制台中仍然存在一个错误。
SCRIPT5007:无法获取未定义或空引用的属性“msie” jquery.mobile-1.2.0.js,第 2536 行字符 5
我似乎不明白这个问题,请帮我解决这个问题。
编辑: 我的html代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="/html/css/phone.css" />
<title>Interview QA</title>
<script type="text/javascript" src="../Scripts/jquery-1.9.1.js"></script>
<script type="text/javascript" src="../Scripts/jquery.mobile-1.2.0.js"></script>
<script type="text/javascript" src="../Scripts/Custom/common.js"></script>
</head>
<body>
<div id="header"></div>
<div id="footer"></div>
<div></div>
</body>
</html>
【问题讨论】:
-
这不是您的帖子的副本吗:stackoverflow.com/questions/14795286/…
标签: javascript jquery windows-phone-8 local-storage internet-explorer-10