UI: Implement JavaScript getOS function Windows platform architecture detection #104136
@ -2,9 +2,6 @@
|
||||
* https://code.videolan.org/VideoLAN.org/websites/-/blob/master/www.videolan.org/include/os-specific.php
|
||||
*/
|
||||
function getOS() {
|
||||
// Init variable OS default
|
||||
var OS = "windows";
|
||||
|
||||
function getOSWinVersionSync() {
|
||||
if (navigator.appVersion.indexOf("Win") != -1) {
|
||||
if (navigator.userAgent.indexOf('Windows NT 5.0') == -1 &&
|
||||
@ -101,6 +98,9 @@ function getOS() {
|
||||
*/
|
||||
navigator.userAgentData.getHighEntropyValues(["architecture", "bitness"])
|
||||
.then(ua => {
|
||||
// Init variable OS default
|
||||
var OS = "windows";
|
||||
|
||||
// Check if the platform is Windows
|
||||
if (navigator.userAgentData.platform === "Windows") {
|
||||
if (ua.architecture === 'arm') {
|
||||
@ -122,6 +122,9 @@ function getOS() {
|
||||
|
||||
// Create function initSync for browsers that don't support navigator.userAgentData (e.g. Gecko-based browsers)
|
||||
function initSync() {
|
||||
// Init variable OS default
|
||||
var OS = "windows";
|
||||
|
||||
getOSWinVersionSync();
|
||||
getOSMacVersion();
|
||||
getOSLinuxVersion();
|
||||
|
Loading…
Reference in New Issue
Block a user