Home >Web Front-end >JS Tutorial >jquery method to determine whether it is ie
Jquery method to determine whether it is IE: 1. Determine whether the browser is IE6 through "if ('undefined' == typeof(...)"; 2. Through "if (!$.support. leadingWhitespace)" to determine whether it is IE6-IE8.
The operating environment of this tutorial: Windows 7 system, jquery1.9 version, thinkpad t480 computer.
Recommended: jquery video tutorial
jquery determines whether it is ie
Before jquery1.9 version, we can use $.browser and $.browser.version to determine the browser type. Starting from version 1.9, $.browser and $.browser.version have been removed and replaced by $.support. You can use the following two methods to determine whether the browser is IE.
1. jquery1.9 or above determines whether the browser is IE6:
if ('undefined' == typeof(document.body.style.maxHeight)) {}
2. jquery1.9 or above determines whether the browser is IE6-IE8:
if (!$.support.leadingWhitespace) {}
Note: jquery2.0 version and later will no longer support IE 6/7/8. In the future, if users need to support IE 6/7/8, they can only use jQuery 1.9.
If you want to use it at the same time:
<!--[if lt IE 9]> <script src='jquery-1.9.0.js'></script> <![endif]--> <!--[if gte IE 9]> <script src='jquery-2.0.0.js'></script> <![endif]-->
The above is the detailed content of jquery method to determine whether it is ie. For more information, please follow other related articles on the PHP Chinese website!