Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/third_party/closure/goog/labs/useragent/extra.js
4122 views
1
/**
2
* @license
3
* Copyright The Closure Library Authors.
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
/**
8
* @fileoverview Provides extra checks for user agent that are not reflected in
9
* the standard user agent checks. This includes runtime heuristics to determine
10
* the true environment on browsers that present a different user agent to
11
* appear to be running in a different environment.
12
*/
13
14
goog.module('goog.labs.userAgent.extra');
15
16
const platform = goog.require('goog.labs.userAgent.platform');
17
18
/**
19
* Checks whether the browser appears to be a desktop-class running on a mobile
20
* device. Starting with iPadOS 13 this is the default for non-mini iPads
21
* running at >=2/3 of the screen. The user agent is otherwise indistinguishable
22
* from Mac Safari. The user can also force desktop on other devices. This logic
23
* previously also checked for Safari, however other iOS browsers have since
24
* adopted the same behavior.
25
*
26
* @return {boolean} Whether the runtime heuristics thinks this is Desktop
27
* Safari on a non-desktop device.
28
*/
29
function isSafariDesktopOnMobile() {
30
return platform.isMacintosh() && goog.global.navigator.maxTouchPoints > 0;
31
}
32
33
exports = {isSafariDesktopOnMobile};
34
35