Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect Tablet & IPad #110

Open
miroslavpejic85 opened this issue Jul 27, 2022 · 0 comments
Open

Detect Tablet & IPad #110

miroslavpejic85 opened this issue Jul 27, 2022 · 0 comments

Comments

@miroslavpejic85
Copy link

miroslavpejic85 commented Jul 27, 2022

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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant