diff options
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r-- | web/share/js/tools.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js index 9fc6384c..fee47824 100644 --- a/web/share/js/tools.js +++ b/web/share/js/tools.js @@ -372,14 +372,6 @@ export var tools = new function() { // Blink engine detection let is_blink = ((is_chrome || is_opera) && !!window.CSS); - // iOS browsers - // https://stackoverflow.com/questions/9038625/detect-if-device-is-ios - // https://github.com/lancedikson/bowser/issues/329 - let is_ios = (!!navigator.platform && ( - /iPad|iPhone|iPod/.test(navigator.platform) - || (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 && !window["MSStream"]) - )); - // Any browser on Mac let is_mac = (( window.navigator.oscpu @@ -391,15 +383,27 @@ export var tools = new function() { // Any Windows let is_win = (navigator && !!(/win/i).exec(navigator.platform)); + // iOS browsers + // https://stackoverflow.com/questions/9038625/detect-if-device-is-ios + // https://github.com/lancedikson/bowser/issues/329 + let is_ios = (!!navigator.platform && ( + /iPad|iPhone|iPod/.test(navigator.platform) + || (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 && !window["MSStream"]) + )); + + let is_android = /android/i.test(navigator.userAgent); + return { "is_opera": is_opera, "is_firefox": is_firefox, "is_safari": is_safari, "is_chrome": is_chrome, "is_blink": is_blink, - "is_ios": is_ios, "is_mac": is_mac, "is_win": is_win, + "is_ios": is_ios, + "is_android": is_android, + "is_mobile": (is_ios || is_android), }; }; self.info("Browser:", self.browser); |