javascript find out if mobile device code example
Example 1: check mobile device
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
// some code..
}
Example 2: detect mobile javascript
/* npm i tappify */
import Tappify from "tappify";
/* Only works in react.js */
function myComponent() {
return <>
Client is using finger *tap tap*
Client is using mouse cursor *click click*
>
}
//more info: https://github.com/asplunds/tappify