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