Reply To: Can Get App button handle multiple systems?

#2267
livemesh
Keymaster

If I understand your question right, you want to change the download link based on the OS from which the user is visiting the page. May guess is that you don’t need to disable the Get App button; you will need to change the URL of the Get-App button in the Javascript based on the OS detected –

p = navigator.platform;

download_link = "http://www.app-download.com/";

if( p === 'iPad' || p === 'iPhone' || p === 'iPod' ){
    download_link = "http://www.app-download.com/app";
}
else if (p.toUpperCase().indexOf('MAC')!==-1) {
download_link = ""http://www.app-download.com/mac-app";
}
else if (p.toUpperCase().indexOf('WIN')!==-1) {
download_link = ""http://www.app-download.com/windows-app";
}
else if (p.toUpperCase().indexOf('LINUX')!==-1) {
download_link = ""http://www.app-download.com/linux-app";
};

$("#get-app-button").attr("href", download_link);

Here is some more information on how to detect the OS –

http://stackoverflow.com/questions/1741933/detect-64-bit-or-32-bit-windows-from-user-agent-or-javascript

http://stackoverflow.com/questions/9038625/detect-if-device-is-ios