Snippet to detect device type
This commit is contained in:
7
snippets/detectDeviceType.md
Normal file
7
snippets/detectDeviceType.md
Normal 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";
|
||||
```
|
||||
Reference in New Issue
Block a user