-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
28 lines (24 loc) · 1.36 KB
/
Copy pathscripts.js
File metadata and controls
28 lines (24 loc) · 1.36 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
function getMobileOperatingSystem() {
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
if (/windows phone/i.test(userAgent)) {
document.getElementById("androidappDownloadButton").innerText = "Only available on Android and iOS"
document.getElementById("androidappDownloadButton").disabled = true
document.getElementById("iosappDownloadButton").innerText = "Only available on Android and iOS"
document.getElementById("iosappDownloadButton").disabled = true
}
else if (/android/i.test(userAgent)) {
document.getElementById("iosappDownloadButton").innerText = "Android App"
document.getElementById("iosappDownloadButton").disabled = true
}
else if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
document.getElementById("androidappDownloadButton").innerText = "Android App"
document.getElementById("androidappDownloadButton").disabled = true
}
else {
document.getElementById("androidappDownloadButton").innerText = "Only available on Android and iOS"
document.getElementById("androidappDownloadButton").disabled = true
document.getElementById("iosappDownloadButton").innerText = "Only available on Android and iOS"
document.getElementById("iosappDownloadButton").disabled = true
}
}
window.onload = getMobileOperatingSystem