Snippet to detect device type

This commit is contained in:
Arjun Mahishi
2017-12-24 13:09:23 +05:30
parent 33ab9be529
commit 4b339020b0

View File

@ -0,0 +1,7 @@
### detectDeviceType
Detects weather the website is being opened in a mobile device or a desktop
```js
const detectDevice = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? "Mobile" : "Desktop";
```