Home  >  Article  >  Web Front-end  >  What to do if IE8 does not support the jQuery version?

What to do if IE8 does not support the jQuery version?

coldplay.xixi
coldplay.xixiOriginal
2020-11-26 10:50:461662browse

Solution to the problem that IE8 does not support the jQuery version: You can load the corresponding version of jQuery by determining the version of the IE browser. Only IE8 can recognize [], and some compatible operations can be performed in IE8 mode.

What to do if IE8 does not support the jQuery version?

The operating environment of this tutorial: windows7 system, jquery2.0.2 and jquery1.11.1 versions. This method is suitable for all brands of computers.

Solution to the problem that IE8 does not support the jQuery version:

You can load the corresponding version of jQuery by determining the version of the IE browser

Use statement266c419352a525843049eb7155ebf872 Only recognized by IE81b771f47d72d900ba74308aee59557f0 Some compatible operations can be performed in IE8 mode. The code is as follows:

  <!--[if !IE]> -->
        <script src="/Scripts/jquery-2.0.2.min.js"></script>
    <!-- <![endif]-->
    <!--[if lte IE 8]>
         <script src="/Scripts/jquery-1.11.1.min.js"></script>
    <![endif]-->
   
     <!--[if gt IE 8]>
         <script src="/Scripts/jquery-2.0.2.min.js"></script>
    <![endif]-->

Explanation:

If it is not IE, use 2.02, IE8 and above also use 2.0.2, IE8 and below use version 1.11

Other matters:

1. I originally wanted to use if else, but I heard that else is not recommended, so I used two if

2. I see that the code for judging non-IE is a little different. The following is the explanation:

In non-IE, the following code is recognized as a comment and will be ignored:

<!--[if IE]>
Non-IE browsers ignore this
<![endif]-->

But the following code is different, there is a sentence sandwiched between the two comments Code, will be ignored in IE, but will be recognized in non-IE.

<!--[if !IE]-->
IE ignores this
<!--[endif]-->

Related learning recommendations: javascript video tutorial

The above is the detailed content of What to do if IE8 does not support the jQuery version?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more