Home >Web Front-end >JS Tutorial >What to do if IE8 does not support the jQuery version?
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.
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!