The code i have works fine with detecting the Os on mac and on my windows pc at home but for some reason the windows pc at my internship detects MacOs. Also on my android it downloads and detects the linux version.
console.log("werkt")
jQuery('.LeButton').click(function() {
console.log(".LeButton")
var OSName = "Unknown OS";
console.log(navigator.appVersion);
if (navigator.appVersion.indexOf("Win") != -1) OSName = 'Windows';
if (navigator.appVersion.indexOf("Mac") != -1) OSName = 'MacOs';
if (navigator.appVersion.indexOf("X11") != -1) OSName = 'UNIX';
if (navigator.appVersion.indexOf("Linux") != -1) OSName = 'Linux';
if (navigator.appVersion.indexOf("Andoid") != -1) OSName = 'Android';
if (navigator.appVersion.indexOf("Linux a") != -1) OSName = 'Android';
if (navigator.appVersion.indexOf("null") != -1) OSName = 'Android';
if (navigator.appVersion.indexOf("iPhone") != -1) OSName = 'Ios';
if (navigator.appVersion.indexOf("iPod") != -1) OSName = 'Ios';
if (navigator.appVersion.indexOf("iPhone Simulator") != -1) OSName = 'Ios';
if (navigator.appVersion.indexOf("MacPPC") != -1) OSName = 'Ios';
if (navigator.appVersion.indexOf("Mac68K") != -1) OSName = 'Ios';
if (navigator.appVersion.indexOf("Pike") != -1) OSName = 'Ios';
if (navigator.appVersion.indexOf("Macintel") != -1) OSName = 'Ios';
if (navigator.appVersion.indexOf("MacIntel") != -1) OSName = 'Ios';
if (OSName == "MacOs") {
window.location = 'https://get.anydesk.com/algsS7Tu/Develto_AnyDesk.dmg';
} else if (OSName == "Windows") {
window.location = 'https://get.anydesk.com/rWkVpCDA/Develto_AnyDesk.exe';
} else if (OSName == "Linux") {
window.location = 'https://get.anydesk.com/FAYb0MAc/Develto_AnyDesk.tar.gz';
} else if (OSName == "Android") {
window.location = 'https://get.anydesk.com/7LUtiVEA/AnyDesk.apk';
} else if (OSName == "Ios") {
window.location = 'https://itunes.apple.com/us/app/anydesk/id1176131273';
}
console.log(OSName)
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<button class="LeButton">Go to download page </button>