IE8 throws error using jQuery

I ran into some problems with IE7 / IE8 and jQuery. My code works in IE 10, FF, Chrome, Safari, Mobile Safari, Mobile Chrome.

Now, to debug, I deleted my own JS file. So here is the code:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> 

There is no link to JS on this page. I have removed all other JS links, and JS is not running on the page itself. When the page loads in IE8, I get this error:

 Line: 4 Error: Object doesn't support this property or method 

enter image description here

The debugger shows above. I donโ€™t know where the problem is. Any help is appreciated.

PS - This is my first โ€œseriousโ€ website development job, and now I see why IE is so hated by the developer community.

+6
source share
3 answers

JQuery 2.0 support for some browsers. See the Release Message at http://blog.jquery.com/2013/04/18/jquery-2-0-released/

Quote from the post:

More support for IE 6/7/8: Remember that this can also affect IE9 and even IE10 if they are used in compatibility view modes that emulate older versions. To prevent new versions of IE from returning to prehistoric modes, we suggest that you always use an X-UA-compatible tag or an HTTP header. If you can use the HTTP header, it is slightly better for performance, as it avoids the potential restart of the browser parser.

Reduced size: The final file 2.0.0 is 12% smaller than 1.9.1 due to the fixes that were only needed for IE 6, 7 and 8. We hoped to remove even more code and increase the size of older Android / WebKit 2 browsers .x are now the weakest link. We carefully monitored the market share of Android 2.x to determine when we can cross out from the support list and do not expect it to take a very long time.

Save jQuery 1.9 (Edit 2015-11-17: jQuery 1.11.3 is the current version of jQuery version 1.x) if there is a problem with IE 6/7/8.

+13
source

use the code in the link below in your html file and add both jquery 2.0+ for the latest browser and 1.9 for older browsers.

https://gist.github.com/dwoodiwiss/5633393

+1
source

I had the same problem: in fact, I referred to such scripts:

 <script src="../js/jquery-ui.js" type="text/javascript"></script> <script src="../js/jquery.min.js" type="text/javascript"></script> 

I fixed this by changing the scripts that reference the order by first calling jquery.min.js.

 <script src="../js/jquery.min.js" type="text/javascript"></script> <script src="../js/jquery-ui.js" type="text/javascript"></script> 

Add the following to web.config:

 <system.webServer> <httpProtocol> <customHeaders> <add name="X-UA-Compatible" value="IE=EmulateIE8" /> </customHeaders> </httpProtocol> </system.webServer> 
0
source

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


All Articles