Last active
March 15, 2021 14:41
-
-
Save dthphuong/7fa282b028e6116d30dd076adf7605a2 to your computer and use it in GitHub Desktop.
Get OS platform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="description" content=""> | |
<meta name="author" content=""> | |
<link rel="icon" href="favicon.ico" type="image/x-icon"> | |
<title>Memori - Connect with ease</title> | |
</head> | |
<body> | |
<script> | |
function getOS() { | |
var userAgent = window.navigator.userAgent, | |
platform = window.navigator.platform, | |
macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], | |
windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'], | |
iosPlatforms = ['iPhone', 'iPad', 'iPod'], | |
os = null; | |
if (macosPlatforms.indexOf(platform) !== -1) { | |
os = 'MacOS'; | |
} else if (iosPlatforms.indexOf(platform) !== -1) { | |
os = 'iOS'; | |
} else if (windowsPlatforms.indexOf(platform) !== -1) { | |
os = 'Windows'; | |
} else if (/Android/.test(userAgent)) { | |
os = 'Android'; | |
} else if (!os && /Linux/.test(platform)) { | |
os = 'Linux'; | |
} | |
return os; | |
} | |
switch (getOS()) { | |
case 'MacOS': | |
case 'iOS': | |
window.location.replace('https://apps.apple.com/vn/app/.....'); | |
break; | |
case 'Android': | |
case 'Windows': | |
case 'Linux': | |
window.location.replace('https://play.google.com/store/apps/details?id=....'); | |
break; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment