device.js
client and server side device / useragent detection for easier adaptive development / design
inspired & partly copied from https://github.com/matthewhudson/device.js but much more performand and flexible.
supports React server side rendering.
Usage
Browser
; // add specific classes like "mobile" "ios" "android" "desktop" to the html element.device; // check at runtimeif devicemobile // do mobile stuff else if devicetablet || devicedesktop // do tablet && desktop stuff
Node
// 1; device; //////////////////////// // 2; const device = ua1;const device2 = ua2;
Getters
deviceorientation
ie9
ie10
touch
ios
iphone
ipod
ipad
android
androidPhone
androidTablet
blackberry
blackberryPhone
blackberryTablet
windows
windowsPhone
windowsTablet
fxos
fxosPhone
fxosTablet
meego
cordova
nodeWebkit
mobile
tablet
desktop
television
portrait
landscape