<!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.
source share