Browse Source

Use userAgentData.mobile instead of deprecated useragent. Closes #1665

pull/1747/head
Gabe Kangas 4 years ago
parent
commit
7fa7f8ee7f
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA
  1. 5
      webroot/js/utils/helpers.js

5
webroot/js/utils/helpers.js

@ -69,10 +69,7 @@ export function hasTouchScreen() {
hasTouch = true; // deprecated, but good fallback hasTouch = true; // deprecated, but good fallback
} else { } else {
// Only as a last resort, fall back to user agent sniffing // Only as a last resort, fall back to user agent sniffing
var UA = navigator.userAgent; hasTouch = navigator.userAgentData.mobile;
hasTouch =
/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) ||
/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
} }
} }
return hasTouch; return hasTouch;

Loading…
Cancel
Save