Home >Web Front-end >JS Tutorial >jquery method to determine whether it is ie

jquery method to determine whether it is ie

藏色散人
藏色散人Original
2020-12-11 10:23:522195browse

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.

jquery method to determine whether it is ie

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=&#39;jquery-1.9.0.js&#39;></script>
<![endif]-->
<!--[if gte IE 9]>    
<script src=&#39;jquery-2.0.0.js&#39;></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!

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