using jquery-2.0.3 in ie8 browser : object doesn&#

2019-04-21 16:20发布

问题:

I used jquery. It work fine in firefox. But when I open it by ie8 get same error : object dosn't suport this property or method . line 834 I disable this line and find same errors in this lines: 836,3316,...

I make sample code and test ,It not show my alerts never:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head id="Head1" runat="server">
<script type="text/javascript" src="jscripts/jquery-2.0.3.js"></script>
<script type="text/javascript" >

    var isIE8 = $.browser.msie && +$.browser.version === 8;
var isIE8 = $.browser.msie && +$.browser.version === 8;
if ( isIE8 ) {
alert("ie8");}


alert("test");
...

Can everyone help me? Thank you!

回答1:

As noted in the comments, jQuery 2.x " does not support Internet Explorer 6, 7, or 8"

From http://api.jquery.com/jQuery.browser/:

This property was removed in jQuery 1.9 and is available only through the jQuery.migrate plugin. Please try to use feature detection instead.



回答2:

http://blog.jquery.com/2013/04/18/jquery-2-0-released/

How 2.0 Changed

Here are some highlights of the changes that jQuery 2.0 brings:

No more support for IE 6/7/8: Remember that this can also affect IE9 and even IE10 if they are used in their “Compatibility View” modes that emulate older versions. To prevent these newer IE versions from slipping back into prehistoric modes, we suggest you always use an X-UA-Compatible tag or HTTP header. If you can use the HTTP header it is slightly better for performance because it avoids a potential browser parser restart.