Recommend this page to a friend! |
Classes of Christian Vigh | jQuery Browser class | README.md | Download |
|
|
DownloadINTRODUCTIONThe $.browser jQuery object is yet another pitiful and lamentable attempt to unify the information provided by various navigators. It tries to detect navigator name, version and other information that could be useful. It currently supports chrome, firefox, ie, opera, safari and webkit-compatible. I can add support for more exotic navigators if you provide me a link where I can download them. I will support MS Edge when the following two conditions will become true :
HOW TO USE IT ?Step 1 : Include jQuery :
Step 2 : include the source file :
And voilą ! the $.browser object is available to your script... REFERENCEThis section describes the information you can retrieve from the $.browser object. A small distinction has been made here between members and properties : - members are properties that always return the same value - properties needs some code to be execute to compute their return value. MEMBERS$.browser.agentReturns the user agent string. For example :
$.browser.applicationVersionA structure describing the browser application version and containing the following properties :
Casting this structure to a string will return the major and minor version. Example : "5.0" $.browser -type related propertiesThe following boolean properties are set to true or false, depending on your browser type : chrome, safari, firefox, opera, ie, webkit or unknown. Only one of them will be true at the same time and reflects the type of browser you are using. The unknown property will be set to true if your browser type cannot be detected. Note that I don't know so far what to do with the webkit property. The $.browser.name property will contain the name of the property in the above list which has been set to true. $.browser.cookiesEnabledTrue if cookies are enabled in the browser. $.browser.displayNameUser-friendly browser display name. $.browser.doNotTrackTrue if "do no track" settings are enabled on your browser. $.browser.languageA structure containing the following properties that specifies the browser's language :
This structure can be casted to a string, to obtain something like, for example, "fr-FR". $.browser.name ##"Browser name, as supplied by the user agent string. $.browser.onlineA boolean indicating whether browing is online or not. $.browser.platformA structure describing the browser's platform :
Note that these information are rarely specified by the browsers. This structure can be casted to a string, which will result in : "os/version". $.browser.productA structure describing the product :
This structure can be casted to a string which will result in the product name. $.browser.vendorA structure describing vendor information : - name : Vendor name. - build : Vendor's application build number. May be largely undefined in IE. This structure can be casted to a string, which will result in : "name/build". $.browser.versionA structure containing the following properties, identifying the browser's version :
The returned string will include the major, minor, revision and build numbers separated by a dot. Missing components will not be included (if the revision is undefined, then the resulting string will only include the major and minor version numbers, even if the build number is defined). PropertiesThis section describes all the runtime properties whose values must be retrieved using :
Note that the val() function is a synonym of prop(). $.browser.prop ( 'javaEnabled' )Returns true if java is enabled in your browser, false otherwise. $.browser.prop ( 'taintEnabled' )To be documented. $.browser.prop ( 'scrollbarWidth' )Returns the width of a vertical scrollbar, in pixels. $.browser.prop ( 'scrollbarHeight' )Returns the height of a horizontal scrollbar, in pixels. |