Home >Web Front-end >JS Tutorial >How does jquery determine whether it is an ie6 browser?

How does jquery determine whether it is an ie6 browser?

coldplay.xixi
coldplay.xixiOriginal
2020-11-25 15:14:322231browse

How jquery determines whether it is an ie6 browser: You can use the [$.browser] method to determine the browser type, the code is [if ($.browser.msie &&($.browser.version == “6.0 ″)&& !$.support.style】.

How does jquery determine whether it is an ie6 browser?

The operating environment of this tutorial: Windows 7 system, jquery version 1.8. This method is suitable for all brands of computers.

Related recommendations: "jQuery Video Tutorial"

How to determine whether jquery is an ie6 browser:

jquery API can use the $.browser method to determine the browser type.

$.browser Available values ​​for the browser kernel identifier: safari opera msie mozilla

Code to determine whether it is an ie6 browser:

if ($.browser.msie && ($.browser.version == “6.0″) && !$.support.style) {
//代码
}

Description: The

$.browser attribute has been removed in jQuery 1.9. Used for Returns relevant information about the browser currently used by the user.

It is not recommended to use this attribute to detect the browser, because it determines the browser information based on the navigator.userAgent attribute, so its identification is not necessarily accurate. .

Syntax

$.browser

Parameters:

  • webkit Boolean type indicates whether it is a webkit-based browser.

  • safari Boolean type indicates whether it is an Apple Safari browser.

  • opera Boolean type indicates Whether it is the opera browser.

  • msie Boolean type indicates whether it is the Microsoft IE browser.

  • mozilla Boolean type indicates whether it is the Mozilla FireFox browser browser.

  • chrome Boolean type indicates whether it is a Google Chrome browser.

  • version String type The version number of the current browser, for example: " 6.0", "7.0".

For more programming-related knowledge, please visit: Programming Learning!!

The above is the detailed content of How does jquery determine whether it is an ie6 browser?. 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