We could simply check the resolution or user agent: const isMobile = Math.min(window.screen.width, window.screen.height) < 768 || navigator.userAgent.indexOf("Mobile") > -1;
Detect mobile in JavaScript
- Post author By Aymeric
- Post date
- Categories In English, Niveau débutant, Programmation
- No Comments on Detect mobile in JavaScript