Share your code. Components are building blocks, you are the architect.

global/is-mobile
v0.0.2
0.0.2
0.0.1
MIT
PUBLIC
13
0     DEPENDENCIES
Build: pass
BuildPass
Build Status: pass
# Checks whether running on a mobile device according to browser data.
Gravatar for undefined
tomlandau
Contributors
Gravatar for undefined
1

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use global/is-mobile in your project
npm i @bit/tomlandau.simple-js.global.is-mobile
Copied

isMobile ()

Checks whether running on a mobile device according to browser data.

Functions (each returns bool):

  • Android
  • BlackBerry
  • iPhone
  • iPod
  • iPad
  • iOS
  • Opera
  • Windows
  • Kindle Fire
  • any

Example

isMobile.Android() => true/false
isMobile.iOS() => true/false
isMobile.any() => true/false
isMobile.KindleFire() => true/false
isMobile.BlackBerry() => true/false

Test Summary


isMobile .Android should return true for Android userAgentPass
isMobile .Android should return false for non Android userAgentPass
isMobile .BlackBerry should return true for BlackBerry userAgentPass
isMobile .BlackBerry should return false for non BlackBerry userAgentPass
isMobile .iPhone should return true for iPhone userAgentPass
isMobile .iPhone should return false for non iPhone userAgentPass
isMobile .iPod should return true for iPod userAgentPass
isMobile .iPod should return false for non iPod userAgentPass
isMobile .iPad should return true for iPad userAgentPass
isMobile .iPad should return false for non iPad userAgentPass
isMobile .iOS should return true for iPhone userAgentPass
isMobile .iOS should return true for iPad userAgentPass
isMobile .iOS should return true for iPod userAgentPass
isMobile .iOS should return false for non iOS userAgentPass
isMobile .Opera should return true for Opera userAgentPass
isMobile .Opera should return false for non Opera userAgentPass
isMobile .Windows should return true for Windows userAgentPass
isMobile .Windows should return false for non Windows userAgentPass
isMobile .KindleFire should return true for KindleFire userAgentPass
isMobile .KindleFire should return false for non KindleFire userAgentPass
isMobile .any should return true for any mobile userAgentPass
isMobile .any should return false for desktop userAgentPass