new Device()
Detects device support capabilities. Using some elements from System.js by MrDoob and Modernizr
- Source:
Members
-
android
-
- Default Value:
- false
- Source:
Properties:
Name Type Description android
boolean Is running on android?
-
arora
-
- Default Value:
- false
- Source:
Properties:
Name Type Description arora
boolean Set to true if running in Arora.
-
audioData
-
- Default Value:
- false
- Source:
Properties:
Name Type Description audioData
boolean Are Audio tags available?
-
canvas
-
- Default Value:
- false
- Source:
Properties:
Name Type Description canvas
boolean Is canvas available?
-
chrome
-
- Default Value:
- false
- Source:
Properties:
Name Type Description chrome
boolean Set to true if running in Chrome.
-
chromeOS
-
- Default Value:
- false
- Source:
Properties:
Name Type Description chromeOS
boolean Is running on chromeOS?
-
cocoonJS
-
- Default Value:
- false
- Source:
Properties:
Name Type Description cocoonJS
boolean Is the game running under CocoonJS?
-
css3D
-
- Default Value:
- false
- Source:
Properties:
Name Type Description css3D
boolean Is css3D available?
-
desktop
-
- Default Value:
- false
- Source:
Properties:
Name Type Description desktop
boolean Is running desktop?
-
ejecta
-
- Default Value:
- false
- Source:
Properties:
Name Type Description ejecta
boolean Is the game running under Ejecta?
-
epiphany
-
- Default Value:
- false
- Source:
Properties:
Name Type Description epiphany
boolean Set to true if running in Epiphany.
-
file
-
- Default Value:
- false
- Source:
Properties:
Name Type Description file
boolean Is file available?
-
fileSystem
-
- Default Value:
- false
- Source:
Properties:
Name Type Description fileSystem
boolean Is fileSystem available?
-
firefox
-
- Default Value:
- false
- Source:
Properties:
Name Type Description firefox
boolean Set to true if running in Firefox.
-
ie
-
- Default Value:
- false
- Source:
Properties:
Name Type Description ie
boolean Set to true if running in Internet Explorer.
-
ieVersion
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description ieVersion
number If running in Internet Explorer this will contain the major version number.
-
iOS
-
- Default Value:
- false
- Source:
Properties:
Name Type Description iOS
boolean Is running on iOS?
-
iPad
-
- Default Value:
- false
- Source:
Properties:
Name Type Description iPad
boolean Is running on iPad?
-
iPhone
-
- Default Value:
- false
- Source:
Properties:
Name Type Description iPhone
boolean Is running on iPhone?
-
iPhone4
-
- Default Value:
- false
- Source:
Properties:
Name Type Description iPhone4
boolean Is running on iPhone4?
-
linux
-
- Default Value:
- false
- Source:
Properties:
Name Type Description linux
boolean Is running on linux?
-
littleEndian
-
- Default Value:
- false
- Source:
Properties:
Name Type Description littleEndian
boolean Is the device big or little endian? (only detected if the browser supports TypedArrays)
-
localStorage
-
- Default Value:
- false
- Source:
Properties:
Name Type Description localStorage
boolean Is localStorage available?
-
m4a
-
Can this device play m4a files?
- Default Value:
- false
- Source:
Properties:
Name Type Description m4a
boolean True if this device can play m4a files.
-
macOS
-
- Default Value:
- false
- Source:
Properties:
Name Type Description macOS
boolean Is running on macOS?
-
midori
-
- Default Value:
- false
- Source:
Properties:
Name Type Description midori
boolean Set to true if running in Midori.
-
mobileSafari
-
- Default Value:
- false
- Source:
Properties:
Name Type Description mobileSafari
boolean Set to true if running in Mobile Safari.
-
mp3
-
- Default Value:
- false
- Source:
Properties:
Name Type Description mp3
boolean Can this device play mp3 files?
-
mspointer
-
- Default Value:
- false
- Source:
Properties:
Name Type Description mspointer
boolean Is mspointer available?
-
ogg
-
- Default Value:
- false
- Source:
Properties:
Name Type Description ogg
boolean Can this device play ogg files?
-
opera
-
- Default Value:
- false
- Source:
Properties:
Name Type Description opera
boolean Set to true if running in Opera.
-
opus
-
- Default Value:
- false
- Source:
Properties:
Name Type Description opus
boolean Can this device play opus files?
-
patchAndroidClearRectBug
-
An optional 'fix' for the horrendous Android stock browser bug https://code.google.com/p/android/issues/detail?id=39247
- Default Value:
- false
- Source:
Properties:
Name Type Description patchAndroidClearRectBug
boolean Description.
-
pixelRatio
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description pixelRatio
number PixelRatio of the host device?
-
pointerLock
-
- Default Value:
- false
- Source:
Properties:
Name Type Description pointerLock
boolean Is Pointer Lock available?
-
quirksMode
-
- Default Value:
- false
- Source:
Properties:
Name Type Description quirksMode
boolean Is the browser running in strict mode (false) or quirks mode? (true)
-
safari
-
- Default Value:
- false
- Source:
Properties:
Name Type Description safari
boolean Set to true if running in Safari.
-
silk
-
- Default Value:
- false
- Source:
Properties:
Name Type Description silk
boolean Set to true if running in the Silk browser (as used on the Amazon Kindle)
-
touch
-
- Default Value:
- false
- Source:
Properties:
Name Type Description touch
boolean Is touch available?
-
trident
-
- Default Value:
- false
- Source:
Properties:
Name Type Description trident
boolean Set to true if running a Trident version of Internet Explorer (IE11+)
-
tridentVersion
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description tridentVersion
number If running in Internet Explorer 11 this will contain the major version number. See http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx
-
typedArray
-
- Default Value:
- false
- Source:
Properties:
Name Type Description typedArray
boolean Does the browser support TypedArrays?
-
vibration
-
- Default Value:
- false
- Source:
Properties:
Name Type Description vibration
boolean Does the device support the Vibration API?
-
wav
-
- Default Value:
- false
- Source:
Properties:
Name Type Description wav
boolean Can this device play wav files?
-
webApp
-
- Default Value:
- false
- Source:
Properties:
Name Type Description webApp
boolean Set to true if running as a WebApp, i.e. within a WebView
-
webAudio
-
- Default Value:
- false
- Source:
Properties:
Name Type Description webAudio
boolean Is the WebAudio API available?
-
webGL
-
- Default Value:
- false
- Source:
Properties:
Name Type Description webGL
boolean Is webGL available?
-
webm
-
- Default Value:
- false
- Source:
Properties:
Name Type Description webm
boolean Can this device play webm files?
-
windows
-
- Default Value:
- false
- Source:
Properties:
Name Type Description windows
boolean Is running on windows?
-
worker
-
- Default Value:
- false
- Source:
Properties:
Name Type Description worker
boolean Is worker available?
Methods
-
canPlayAudio(type) → {boolean}
-
Check whether the host environment can play audio.
Parameters:
Name Type Description type
string One of 'mp3, 'ogg', 'm4a', 'wav', 'webm'.
- Source:
Returns:
True if the given file type is supported by the browser, otherwise false.
- Type
- boolean
-
isConsoleOpen() → {boolean}
-
Check whether the console is open.
- Source:
Returns:
True if the browser dev console is open.
- Type
- boolean