Skip to content

utility library for identifying in which browser and device your code is running

Notifications You must be signed in to change notification settings

lucamezzalira/EnvironmentIdentifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

utility library for identifying in which browser and device your code is running

Resources

Stars

Watchers

Forks

Packages

No packages published