JavaScript runtime error: unable to get property "msie" from undefined or null reference

I just tried changing the jquery ui links to the main page. I get the error above only in Internet Explorer. I am not getting error in Firefox and Chrome.

This is the jquery code where the error occurs:

return a.browser.msie?(b=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),c=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),b<c?a(window).width()+"px":b+"px"):a(document).width()+"px"},resize:function(){var b=a([]);a.each(a.ui.dialog.overlay.instances,function() 

I have a home page below:

 <head id="Head1" runat="server"> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/redmond/jquery-ui.css" type="text/css" /> <asp:ContentPlaceHolder ID="ExtraHeadContent" runat="server"> </asp:ContentPlaceHolder> </head> <form id="form2" runat="server"> <asp:ScriptManager ID="ScriptManagerService" runat="server"> <Scripts> <asp:ScriptReference Path="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ScriptMode="Auto" /> <asp:ScriptReference Path="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" ScriptMode="Auto" /> </Scripts> </asp:ScriptManager> </form> </body> 

Please let me know what I need to do? I tried putting jquery links in the chapter section, but the jquery code inside my aspx file seems to give an error if the dialog object is not specified, not defined or the tooltip object. I think the jquery library does not load when I try to put links in a chapter section.

+6
source share
4 answers

jQuery.browser was removed in jQuery 1.9 (and you use 1.10), so any attempt to process it as an object (i.e. access the msie property) is doomed to failure. If you still want to use it, enable the jQuery migrate plugin along with jQuery

+18
source

I updated jquery-ui to 1.11.3 and the problem went away.

+3
source

Add a library from the specified link in your project.

http://code.jquery.com/jquery-migrate-1.2.1.js

or

Register below the link on your page

 <script type="text/javascript" src="code.jquery.com/jquery-migrate-1.2.1.js"></script> 
+1
source

jquery-browser-plugin now provides a $ .browser object. Including $ .browser.msie

0
source

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


All Articles