From 7fa7f8ee7f945ad1b6390d0c8f0f615b532029aa Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Fri, 25 Feb 2022 15:29:58 -0800 Subject: [PATCH] Use userAgentData.mobile instead of deprecated useragent. Closes #1665 --- webroot/js/utils/helpers.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/webroot/js/utils/helpers.js b/webroot/js/utils/helpers.js index 37916cd88..cd2db3435 100644 --- a/webroot/js/utils/helpers.js +++ b/webroot/js/utils/helpers.js @@ -69,10 +69,7 @@ export function hasTouchScreen() { hasTouch = true; // deprecated, but good fallback } else { // Only as a last resort, fall back to user agent sniffing - var UA = navigator.userAgent; - hasTouch = - /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || - /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA); + hasTouch = navigator.userAgentData.mobile; } } return hasTouch;