UI: Implement JavaScript getOS function Windows platform architecture detection #104136

Merged
Márton Lente merged 15 commits from get-os-win-arm into main 2024-11-08 12:03:41 +01:00
Showing only changes of commit 8f8b84f6eb - Show all commits

View File

@ -5,13 +5,6 @@ function getOS() {
// Init variable OS default
var OS = "windows";
// Check if the browser method 'navigator.userAgentData' is supported
if (navigator.userAgentData && typeof navigator.userAgentData.getHighEntropyValues == 'function') {
console.log('navigator.userAgentData.getHighEntropyValues is supported');
} else {
console.log('navigator.userAgentData.getHighEntropyValues is not supported');
}
function getOSWinVersion() {
if (navigator.appVersion.indexOf("Win") != -1) {
if (navigator.userAgent.indexOf('Windows NT 5.0') == -1 &&
@ -91,12 +84,24 @@ function getOS() {
if (navigator.platform.indexOf("FreeBSD") != -1) OS = "freebsd";
}
// Create functions init
function init() {
// Check if the browser method 'navigator.userAgentData' is supported
if (navigator.userAgentData && typeof navigator.userAgentData.getHighEntropyValues == 'function') {
initAsync();
} else {
initSync();
}
}
function initSync() {
getOSWinVersion();
getOSMacVersion();
getOSLinuxVersion();
getOSiPadVersion();
getOSFreeBSDVersion();
console.log('initSync');
}
function initAsync() {
@ -108,6 +113,8 @@ function getOS() {
getOSLinuxVersion();
getOSiPadVersion();
getOSFreeBSDVersion();
console.log('initAsync');
})
}