JQuery removed $ from version 1.9. browser and $. browser. version, replaced by $. support. Let's take a look at the specific usage method. jQuery has removed $ from version 1.9. browser and $. browser. version, replaced by $. 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:
The Code is as follows:
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:
The Code is as follows:
$. 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:
The Code is as follows:
// Old
If ($. browser. msie & 7> $. browser. version ){}
// New
If ('undefined' = typeof (document. body. style. maxHeight )){}
Check whether it is IE 6-8:
The Code is as follows:
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