Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SCRIPT5009: 'JSON' is undefined in IE 10 The value of the property '$' is null or undefined, not a Function object

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

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

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

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)

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

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

question 3) am i missing any jquery refrence.

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

like image 500
AMS Avatar asked Sep 11 '13 06:09

AMS


1 Answers

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

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

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.

like image 185
user3639335 Avatar answered Sep 21 '22 02:09

user3639335