Snippet to detect device type

This commit is contained in:
Arjun Mahishi
2017-12-24 13:09:23 +05:30
parent 7dee250830
commit 391b9cdcfe

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";
```