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?
-
cancelFullscreen
-
- Source:
Properties:
Name Type Description cancelFullscreen
string If the browser supports the Full Screen API this holds the call you need to use to cancel it.
-
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?
-
cocoonJSApp
-
- Default Value:
- false
- Source:
Properties:
Name Type Description cocoonJSApp
boolean Is this game running with CocoonJS.App?
-
cordova
-
- Default Value:
- false
- Source:
Properties:
Name Type Description cordova
boolean Is the game running under Apache Cordova?
-
crosswalk
-
- Default Value:
- false
- Source:
Properties:
Name Type Description crosswalk
boolean Is the game running under the Intel Crosswalk XDK?
-
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.
-
fullscreen
-
- Default Value:
- false
- Source:
Properties:
Name Type Description fullscreen
boolean Does the browser support the Full Screen API?
-
fullscreenKeyboard
-
- Default Value:
- false
- Source:
Properties:
Name Type Description fullscreenKeyboard
boolean Does the browser support access to the Keyboard during Full Screen mode?
-
game
-
- Source:
Properties:
Name Type Description game
Phaser.Game A reference to the currently running game.
-
getUserMedia
-
- Default Value:
- false
- Source:
Properties:
Name Type Description getUserMedia
boolean Does the device support the getUserMedia API?
-
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. Beyond IE10 you should use Device.trident and Device.tridentVersion.
-
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?
-
node
-
- Default Value:
- false
- Source:
Properties:
Name Type Description node
boolean Is the game running under Node.js?
-
nodeWebkit
-
- Default Value:
- false
- Source:
Properties:
Name Type Description nodeWebkit
boolean Is the game running under Node-Webkit?
-
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?
-
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)
-
requestFullscreen
-
- Source:
Properties:
Name Type Description requestFullscreen
string If the browser supports the Full Screen API this holds the call you need to use to activate it.
-
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)
-
support32bit
-
- Default Value:
- false
- Source:
Properties:
Name Type Description support32bit
boolean Does the device context support 32bit pixel manipulation using array buffer views?
-
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?
-
windowsPhone
-
- Default Value:
- false
- Source:
Properties:
Name Type Description windowsPhone
boolean Is running on a Windows Phone?
-
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' or 'opus'.
- Source:
Returns:
True if the given file type is supported by the browser, otherwise false.
- Type
- boolean
-
checkFullScreenSupport()
-
Checks for support of the Full Screen API.
- Source:
-
isAndroidStockBrowser()
-
A class-static function to check wether we’re running on an Android Stock browser. Autors might want to scale down on effects and switch to the CANVAS rendering method on those devices. Usage: var defaultRenderingMode = Phaser.Device.isAndroidStockBrowser() ? Phaser.CANVAS : Phaser.AUTO;
- Source:
-
isConsoleOpen() → {boolean}
-
Check whether the console is open. Note that this only works in Firefox with Firebug and earlier versions of Chrome. It used to work in Chrome, but then they removed the ability: http://src.chromium.org/viewvc/blink?view=revision&revision=151136
- Source:
Returns:
True if the browser dev console is open.
- Type
- boolean