We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
navigator.userAgentData
1 parent eb914e6 commit fe07ea2Copy full SHA for fe07ea2
src/constants.js
@@ -1,4 +1,12 @@
1
-var IS_MAC = /Mac/.test(navigator.userAgent);
+function uaDetect(platform, re) {
2
+ if (navigator.userAgentData) {
3
+ return platform === navigator.userAgentData.platform;
4
+ }
5
+
6
+ return re.test(navigator.userAgent);
7
+}
8
9
+var IS_MAC = uaDetect("macOS", /Mac/);
10
11
var KEY_A = 65;
12
var KEY_COMMA = 188;
@@ -21,4 +29,4 @@ var TAG_SELECT = 1;
21
29
var TAG_INPUT = 2;
22
30
23
31
// for now, android support in general is too spotty to support validity
24
-var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;
32
+var SUPPORTS_VALIDITY_API = !uaDetect("Android", /android/i) && !!document.createElement('input').validity;
0 commit comments