v0.0.1
This commit is contained in:
12
web/lib/components/detectOS.js
Normal file
12
web/lib/components/detectOS.js
Normal file
@@ -0,0 +1,12 @@
|
||||
function detectOS() {
|
||||
const platform = navigator.platform.toLowerCase(),
|
||||
iosPlatforms = ['iphone', 'ipad', 'ipod', 'ipod touch'];
|
||||
|
||||
if (platform.includes('mac')) return 'MacOS';
|
||||
if (iosPlatforms.includes(platform)) return 'iOS';
|
||||
if (platform.includes('win')) return 'Windows';
|
||||
if (/android/.test(navigator.userAgent.toLowerCase())) return 'Android';
|
||||
if (/linux/.test(platform)) return 'Linux';
|
||||
|
||||
return 'unknown';
|
||||
}
|
||||
Reference in New Issue
Block a user