Simple module that can be used to try to detect the browser in use.If possible the use of this module should be avoided:
it should only be used if the behavior can't be guessed using feature detection. The module does not contain an extensive list
of browsers, new method were added only when needed in the Lightstreamer JavaScript Client library.
There are two kinds of methods, one does simply recognize the browsers, the other can also discern the browser version. As most of the methods are based on User Agent inspections all the method names contain the "probably" word to recall their intrinsic weakness.
There are two kinds of methods, one does simply recognize the browsers, the other can also discern the browser version. As most of the methods are based on User Agent inspections all the method names contain the "probably" word to recall their intrinsic weakness.
Method Summary
- isProbablyAKhtml
- Check if the browser in use is probably a KHTML browser or not
- isProbablyAndroidBrowser
- Check if the browser in use is probably an Android stock browser or not
- isProbablyApple
- Check if the browser in use is probably an Apple Browser (i.
- isProbablyAWebkit
- Check if the browser in use is probably a WebKit based browser or not
- isProbablyChrome
- Check if the browser in use is probably a Chrome (or Chrome tab) or not.
- isProbablyFX
- Check if the browser in use is probably a Firefox or not.
- isProbablyIE
- Check if the browser in use is probably an Internet Explorer or not.
- isProbablyKonqueror
- Check if the browser in use is probably a Konqueror or not.
- isProbablyOldOpera
- Check if the browser in use is probably an old Opera (i.
- isProbablyOperaMobile
- Check if the browser in use is probably an Opera Mobile or not
- isProbablyPlaystation
- Check if the browser in use is probably a Playstation 3 browser or not
- isProbablyRekonq
- Check if the browser in use is probably a rekonq or not
Method Detail
-
<static> isProbablyAKhtml() → {Boolean}
-
Check if the browser in use is probably a KHTML browser or not
Returns:
true if probably a KHTML browser, false if probably not.- Type
- Boolean
-
<static> isProbablyAndroidBrowser() → {Boolean}
-
Check if the browser in use is probably an Android stock browser or not
Returns:
true if probably an Android stock browser, false if probably not.- Type
- Boolean
-
<static> isProbablyApple(requestedVersion, orLowerFlag) → {Boolean}
-
Check if the browser in use is probably an Apple Browser (i.e. Safari or Safari Mobile) or not. A specific version or version range can be requested.
Parameters:
Name Type Argument Description requestedVersion
Number <optional>
The version to be checked. If not specified any version will do. orLowerFlag
Boolean <optional>
true to check versions up to the specified one, false to check for greater versions; the specified version is always included. If missing only the specified version is considered. Returns:
true if the browser is probably the correct one, false if probably not.- Type
- Boolean
-
<static> isProbablyAWebkit() → {Boolean}
-
Check if the browser in use is probably a WebKit based browser or not
Returns:
true if probably a WebKit based browser, false if probably not.- Type
- Boolean
-
<static> isProbablyChrome(requestedVersion, orLowerFlag) → {Boolean}
-
Check if the browser in use is probably a Chrome (or Chrome tab) or not. A specific version or version range can be requested.
Parameters:
Name Type Argument Description requestedVersion
Number <optional>
The version to be checked. If not specified any version will do. orLowerFlag
Boolean <optional>
true to check versions up to the specified one, false to check for greater versions; the specified version is always included. If missing only the specified version is considered. Returns:
true if the browser is probably the correct one, false if probably not.- Type
- Boolean
-
<static> isProbablyFX(requestedVersion, orLowerFlag) → {Boolean}
-
Check if the browser in use is probably a Firefox or not. A specific version or version range can be requested.
Parameters:
Name Type Argument Description requestedVersion
Number <optional>
The version to be checked. If not specified any version will do. orLowerFlag
Boolean <optional>
true to check versions up to the specified one, false to check for greater versions; the specified version is always included. If missing only the specified version is considered. Returns:
true if the browser is probably the correct one, false if probably not.- Type
- Boolean
-
<static> isProbablyIE(requestedVersion, orLowerFlag) → {Boolean}
-
Check if the browser in use is probably an Internet Explorer or not. A specific version or version range can be requested.
Parameters:
Name Type Argument Description requestedVersion
Number <optional>
The version to be checked. If not specified any version will do. orLowerFlag
Boolean <optional>
true to check versions up to the specified one, false to check for greater versions; the specified version is always included. If missing only the specified version is considered. Returns:
true if the browser is probably the correct one, false if probably not.- Type
- Boolean
-
<static> isProbablyKonqueror(requestedVersion, orLowerFlag) → {Boolean}
-
Check if the browser in use is probably a Konqueror or not. A specific version or version range can be requested.
Parameters:
Name Type Argument Description requestedVersion
Number <optional>
The version to be checked. If not specified any version will do. orLowerFlag
Boolean <optional>
true to check versions up to the specified one, false to check for greater versions; the specified version is always included. If missing only the specified version is considered. Returns:
true if the browser is probably the correct one, false if probably not.- Type
- Boolean
-
<static> isProbablyOldOpera(requestedVersion, orLowerFlag) → {Boolean}
-
Check if the browser in use is probably an old Opera (i.e.: up to the WebKit switch) or not. A specific version or version range can be requested.
Parameters:
Name Type Argument Description requestedVersion
Number <optional>
The version to be checked. If not specified any version will do. orLowerFlag
Boolean <optional>
true to check versions up to the specified one, false to check for greater versions; the specified version is always included. If missing only the specified version is considered. Returns:
true if the browser is probably the correct one, false if probably not.- Type
- Boolean
-
<static> isProbablyOperaMobile() → {Boolean}
-
Check if the browser in use is probably an Opera Mobile or not
Returns:
true if probably a an Opera Mobile, false if probably not.- Type
- Boolean
-
<static> isProbablyPlaystation() → {Boolean}
-
Check if the browser in use is probably a Playstation 3 browser or not
Returns:
true if probably a Playstation 3 browser, false if probably not.- Type
- Boolean
-
<static> isProbablyRekonq() → {Boolean}
-
Check if the browser in use is probably a rekonq or not
Returns:
true if probably a rekonq, false if probably not.- Type
- Boolean