jquery method to determine whether it is IE

Jquery method to determine whether it is IE: 1. Determine whether the browser is IE6 by "if ('undefined' == typeof(...)"; 2. Determine whether it is by "if (!$.support.leadingWhitespace)" IE6-IE8 is



fine . The operating environment of this tutorial: Windows7 system, jquery1.9 version, this method is applicable to all brand computers.

Recommendation: jquery video tutorial

jquery to determine 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 were removed and replaced by $.support. The following two methods can be used to determine whether the browser is IE.

1. Jquery version 1.9 or higher determines whether the browser is IE6:

1

if ('undefined' == typeof(document.body.style.maxHeight)) {}

2. Jquery version 1.9 or higher determines whether the browser is IE6-IE8 :

1

if (!$.support.leadingWhitespace) {}

Note: jQuery 2.0 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 at the same time:

1

2

3

4

5

6

 

Guess you like

Origin blog.csdn.net/an17822307871/article/details/114069157