You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
360 B
16 lines
360 B
|
2 years ago
|
/**
|
||
|
|
* Checks if current device reports itself as “mobile”.
|
||
|
|
* Very simple, not very reliable.
|
||
|
|
*
|
||
|
|
* @returns {boolean}
|
||
|
|
*/
|
||
|
|
export default function isMobileDevice () {
|
||
|
|
if (typeof window !== 'undefined'
|
||
|
|
&& window.navigator
|
||
|
|
&& window.navigator.userAgent
|
||
|
|
&& window.navigator.userAgent.match(/Mobi/)) {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
return false
|
||
|
|
}
|