# Check if mobile

**URL:** https://phaser.discourse.group/t/check-if-mobile/305
**Category:** Phaser 3
**Created:** [December 13, 2018, 11:35am UTC](https://phaser.discourse.group/t/check-if-mobile/305 "2018-12-13T11:35:39Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Fredrik](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/fredrik/32/200_2.png) [@Fredrik](https://phaser.discourse.group/u/Fredrik)
#### Post date: [December 13, 2018, 11:35am UTC](https://phaser.discourse.group/t/check-if-mobile/305/1 "2018-12-13T11:35:39Z")

</div>

Is there any way in Phaser 3 to check if the current device is desktop or mobile (or similar)? I think this was available in Phaser 2 but I can’t seem to find anything for v3.

---

<div class="post-metadata">

### Author: ![Telinc1](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/telinc1/32/60_2.png) [@Telinc1](https://phaser.discourse.group/u/Telinc1)
#### Post date: [December 13, 2018, 1:18pm UTC](https://phaser.discourse.group/t/check-if-mobile/305/2 "2018-12-13T13:18:54Z")

</div>

You can use the `device` property on your Game instance to access the [device configuration](https://photonstorm.github.io/phaser3-docs/Phaser.html#.DeviceConf), similarly to Phaser 2.

---

<div class="post-metadata">

### Author: ![jamespierce](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jamespierce/32/66_2.png) [@jamespierce](https://phaser.discourse.group/u/jamespierce)
#### Post date: [December 13, 2018, 1:45pm UTC](https://phaser.discourse.group/t/check-if-mobile/305/3 "2018-12-13T13:45:14Z")

</div>

> [@Fredrik](#):
>
> Is there any way in Phaser 3 to check if the current device is desktop or mobile (or similar)?

Hey I’ve written a blog post explaining it in detail: [How to Check if a Player is on Mobile or Desktop](https://browsergameshub.com/check-player-is-on-mobile-or-desktop/)

Checking for the device / user agent can be unreliable at times. Actually, even Phaser has to guess what the player’s device is because currently there isn’t a conform way to check that across all browsers & OS & devices. That’s why usually it’s much more reliable to **check for touch input** instead of trying to guess the user’s device.

Anyways, I’ve described both methods in my [blog post](https://browsergameshub.com/check-player-is-on-mobile-or-desktop/) if you’re interested.

---

<div class="post-metadata">

### Author: ![Fredrik](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/fredrik/32/200_2.png) [@Fredrik](https://phaser.discourse.group/u/Fredrik)
#### Post date: [December 15, 2018, 12:49pm UTC](https://phaser.discourse.group/t/check-if-mobile/305/4 "2018-12-15T12:49:00Z")

</div>

Thanks, I will check it out!

@Telinc1 - for some reason this did not work for me so I ended up checking the user agent instead.

---

<div class="post-metadata">

### Author: ![User1](https://avatars.discourse-cdn.com/v4/letter/u/5daacb/32.png) [@User1](https://phaser.discourse.group/u/User1)
#### Post date: [April 30, 2019, 2:46pm UTC](https://phaser.discourse.group/t/check-if-mobile/305/5 "2019-04-30T14:46:44Z")

</div>

```
if (this.sys.game.device.os.desktop){
            console.log("desktop")
}
else{
           console.log("mobile")
}
```
