gpt4 book ai didi

c# - SCRIPT5009 : 'JSON' is undefined in IE 10 The value of the property '$' is null or undefined, 不是函数对象

转载 作者:数据小太阳 更新时间:2023-10-29 05:30:04 25 4
gpt4 key购买 nike

   <!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Hello World</title>
<link href="StyleSheet.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="Scripts/jquery-2.0.3.js">
$(document).ready(function () {

<%--$("#width").val() = $(window).width();
$("#height").val() = $(window).height();--%>


});
</script>
<script type="text/javascript">
$(document).ready(function () {
$("#width").val($(window).width());
$("#height").val($(window).height());
});
</script>
</head>
<body>
<form id="form1" runat="server">
<input id="width" type="hidden" runat="server" />
<input id="height" type="hidden" runat="server" />
</form>
</body>
</html>

上面是我的 aspx 代码和 jquery 脚本,它给出了窗口的高度和宽度。

当我从 visual studio http://localhost/Mypage.aspx 运行 web 应用程序时,这段代码在所有浏览器上都完美无缺

但是当我在 iis 上托管它并使用我的机器名称 http://MyMachine/Mypage.aspx 运行时,它给出了 JSON undefined 和 Property "$"is null or undefined 错误。(这仅在 IE 10(非兼容模式)下,对于 chrome 它工作正常)

问题 1) 我们是否需要处理 IE 10 的任何安全限制?

问题2)当我把它放在iis上并在我自己的机器上用机器名运行它时,为什么会这样?

问题 3) 我是否缺少任何 jquery 引用。

问题 4) 显而易见的一个,这个问题的任何解决方案。

最佳答案

按照许多人的建议使用元标记。

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

但我想给一个重要提示。 mata 标签应该是 head 标签中的第一个标签。我读过它的一些地方,如果它不是第一个标签,它就不会起作用。

关于c# - SCRIPT5009 : 'JSON' is undefined in IE 10 The value of the property '$' is null or undefined, 不是函数对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18734247/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com