environment-identifier

1.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i environment-identifier

Weekly Downloads

0

Version

1.1.0

License

ISC

Last publish

Collaborators

  • lucamezzalira