SCRIPT5009:“JSON”未定义在IE 10的财产“$”的值为null或undefined,而不是一个函数对象 [英] SCRIPT5009: 'JSON' is undefined in IE 10 The value of the property '$' is null or undefined, not a Function object

查看:809
本文介绍了SCRIPT5009:“JSON”未定义在IE 10的财产“$”的值为null或undefined,而不是一个函数对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

   <!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>



以上是我用jQuery脚本给窗口的高度和宽度的aspx代码。

the above is my aspx code with jquery script which gives the window height and width.

这段代码在所有当我运行从Visual Studio的Web应用程序浏览器完全正常 HTTP://localhost/Mypage.aspx

this code perfectly fine on all the browsers when i run the web app from visual studio http://localhost/Mypage.aspx

但是当我主持它在IIS和我的机器名运行 HTTP://MyMachine/Mypage.aspx 它提供了JSON未定义的属性$为空或未定义的错误。(这仅是在IE 10(非兼容模式),镀铬它工作正常)

but when i host it on iis and run with my machine name http://MyMachine/Mypage.aspx it gives JSON undefined and the Property "$" is null or undefined errors.( this is only in IE 10 (non-compatibility mode) , for chrome it works fine)

问题1)我们需要照顾的任何安全约束IE 10?

question 1) do we need to take care of any security constraints for IE 10?

问题2)当我主持它在IIS和运行它为什么会发生这样它与我自己的机器上的机器名?

question 2) why does it happen this way when i host it on iis and run it with machine name on my own machine?

问题3)我失去了所有的jQuery refrence。

question 3) am i missing any jquery refrence.

问题4)明显的,任何解决这个问题。

question 4) obvious one, any solution to this problem.

推荐答案

使用Meta标记被许多人所建议的。

use the Meta tag as suggested by many of the people.

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



但我想给一个importatnt提示。马塔标签应该是在头标记的第一个标签。我已读它的一些,其中,如果它不是第一标签它不会有其效果。

but I want to give an importatnt tip. the mata tag should be the first tag in the head tag. I have read it some where if it is not the first tag it would not have its effect.

这篇关于SCRIPT5009:“JSON”未定义在IE 10的财产“$”的值为null或undefined,而不是一个函数对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆