JQuery removed $. browser and $. browser. version from version 1.9 and replaced it with $. support. In the latest version 2.0, IE 6/7/8 is no longer supported. Later, if you need to support IE 6/7/8, you can only use jQuery 1.9. To fully support IE and mix jQuery 1.9 and 2.0, the official solution is:
<!--[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]-->
For a long time, this will facilitate processing separately based on browser features in complex cases, rather than simply detecting browser types and versions. However, at present, many old programs cannot be transplanted directly to support the features of the browser, so I have found some solutions that can be replaced directly on the Internet.
Determine the browser type:
$.browser.mozilla = /firefox/.test(navigator.userAgent.toLowerCase());$.browser.webkit = /webkit/.test(navigator.userAgent.toLowerCase());$.browser.opera = /opera/.test(navigator.userAgent.toLowerCase());$.browser.msie = /msie/.test(navigator.userAgent.toLowerCase());
The expression after the equal sign returns true/false, which can be directly used to replace the original $. browser. msie. If you want to check whether it is IE6, you can write it like this:
// Oldif ($.browser.msie && 7 > $.browser.version) {}// Newif ('undefined' == typeof(document.body.style.maxHeight)) {}
Check whether it is IE 6-8:
if (!$.support.leadingWhitespace) {}
The ultimate method is to replace it with another class library. You can refer to an article written by a foreigner:
Browser detect
Articles you may be interested in
- Jquery $. ajax $. post or $. get: How to submit the checkbox Value
- Javascript determines whether the mouse is left or right-click-compatible with ie, firefox, chrome, and other major browsers
- JavaScript array operation function Summary (push, pop, join, shift, unshift, slice, splice, concat)
- Use php functions in the smarty template and how to use multiple functions for a variable in the smarty Template
- Comparison and Analysis of string encoding functions escape, encodeURI, and encodeURIComponent in javascript
- Use the PHP function memory_get_usage to obtain the current PHP memory consumption for program performance optimization.
- Common Javascript Verification Code collections such as js verification URLs
- Extension of the for loop in the smarty Template