muaz-khan / DetectRTC

DetectRTC is a tiny JavaScript library that can be used to detect WebRTC features e.g. system having speakers, microphone or webcam, screen capturing is supported, number of audio/video devices etc. https://www.webrtc-experiment.com/DetectRTC/
https://www.webrtc-experiment.com/DetectRTC/
MIT License
664 stars 163 forks source link

Detect Tablet & IPad #110

Open miroslavpejic85 opened 2 years ago

miroslavpejic85 commented 2 years ago

It would be great to add if the device is a Tablet or IPad

const userAgent = navigator.userAgent.toLowerCase();

const isTablet = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(userAgent);

const isIpad = /macintosh/.test(userAgent) && 'ontouchend' in document;