Home > Web Front-end > JS Tutorial > body text

jquery method to determine whether it is ie

藏色散人
Release: 2023-01-04 09:36:53
Original
2160 people have browsed it

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)) {}
Copy after login

2. jquery1.9 or above determines whether the browser is IE6-IE8:

if (!$.support.leadingWhitespace) {}
Copy after login

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]-->
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template