SCRIPT5009: "JSON" 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> 

above is my aspx code with a jquery script that gives the height and width of the window.

this code works great for all browsers when launching a web application from visual studio http://localhost/Mypage.aspx

but when I post it on iis and run http://MyMachine/Mypage.aspx with the name of my machine, it gives JSON undefined, and the "$" property is errors in null or undefined (this is only in IE 10 (incompatible mode) , for chrome it works great)

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

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

question 3) I am missing some jquery refrence.

Question 4) The obvious, any solution to this problem.

+6
source share
3 answers

use the meta tag suggested by many people.

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

but I want to give an importatnt hint. The mata tag must be the first tag in the header tag. I read it somewhere, if this is not the first tag that would have no effect.

+3
source

Do you have a Scripts folder with jquery on the server? I suggest you debug with a violinist and see if jquery is loaded correctly or if there is an http error.

0
source

as I4v suggested, adding this to the header, fixed a bug for me:

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

Thanks guys,

0
source

Source: https://habr.com/ru/post/953604/


All Articles