1.1.0 • Published 10 years ago

environment-identifier v1.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
10 years ago

EnvironmentIdentifier

utility library for retrieving in which browser and device your javascript application is running

APIs

EnvironmentIdentifier has the following APIs, all the parameters return a boolean value:

Browsers related

isChromeForAndroid()
isChromeForIOS()
isSafariForIOS()
isStockBrowser()
isInternetExplorerMobile()

Devices related

isTablet()
isSmartphone()
isIOS()
isAndroid()
isMac()
isWindows()
isWindowsPhone()

Example

var envIdentifier = new EnvironmentIdentifier();

var analysis = "isWindows: " + envIdentifier.isWindows() + "<br/>"
                    + "isWindowsPhone: " + envIdentifier.isWindowsPhone() + "<br/>"
                    + "isMac: " + envIdentifier.isMac() + "<br/>"
                    + "isAndroid: " + envIdentifier.isAndroid() + "<br/>"
                    + "isIOS: " + envIdentifier.isIOS() + "<br/>"
                    + "isTablet: " + envIdentifier.isTablet() + "<br/>"
                    + "isSmartphone: " + envIdentifier.isSmartphone() + "<br/>"
                    + "isSafari: " + envIdentifier.isSafariForIOS() + "<br/>"
                    + "isInternetExplorer: " + envIdentifier.isInternetExplorerMobile() + "<br/>"
                    + "isStockBrowser: " + envIdentifier.isStockBrowser() + "<br/>"
                    + "isChromeForAndroid: " + envIdentifier.isChromeForAndroid() + "<br/>"
                    + "isChromeForIOS: " + envIdentifier.isChromeForIOS() + "<br/>";

body.innerHTML = analysis;

For a complete example please check the example folder