Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

find device type javascript

const detectDeviceType = () =>
   /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
      navigator.userAgent
   )
      ? 'Mobile'
      : /(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(
           navigator.userAgent
        )
      ? 'Tablet'
      : 'Desktop';
console.log(detectDeviceType());
Source by github.com #
 
PREVIOUS NEXT
Tagged: #find #device #type #javascript
ADD COMMENT
Topic
Name
3+9 =