-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
74 lines (59 loc) · 1.64 KB
/
index.js
File metadata and controls
74 lines (59 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function getOperatingSystemName() {
let operatingSystem = "Unknown";
if (typeof navigator !== "undefined" && navigator && navigator.userAgent) {
if (navigator.userAgent.indexOf("X11") !== -1) {
operatingSystem = "Unix";
}
if (navigator.userAgent.indexOf("Win") !== -1) {
operatingSystem = "Windows";
}
if (navigator.userAgent.indexOf("Mac") !== -1) {
operatingSystem = "macOS";
}
if (navigator.userAgent.indexOf("Linux") !== -1) {
operatingSystem = "Linux";
}
if (navigator.userAgent.indexOf("Android") !== -1) {
operatingSystem = "Android";
}
if (
navigator.userAgent.indexOf("iPhone") !== -1 ||
navigator.userAgent.indexOf("iPad") !== -1 ||
navigator.userAgent.indexOf("iPod") !== -1
) {
operatingSystem = "iOS";
}
}
return operatingSystem;
}
export function isUNIX() {
const osName = getOperatingSystemName();
if (osName === "Unix") return true;
return false;
}
export function isWindows() {
const osName = getOperatingSystemName();
if (osName === "Windows") return true;
return false;
}
export function isMacOS() {
const osName = getOperatingSystemName();
if (osName === "macOS") return true;
return false;
}
export function isLinux() {
const osName = getOperatingSystemName();
if (osName === "Linux") return true;
return false;
}
export function isAndroid() {
const osName = getOperatingSystemName();
if (osName === "Android") return true;
return false;
}
export function isIOS() {
const osName = getOperatingSystemName();
if (osName === "iOS") return true;
return false;
}
export default getOperatingSystemName;