The idea is to make a button that says "get app now" with a link that changes based on whether its an android phone iPhone or none. I looked through stackexchange for answers but nothing is clear for someone who has no js experience
Try this,
Unknown is desktop or any other phone
function getMobileOperatingSystem() {
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
if( userAgent.match( /iPad/i ) || userAgent.match( /iPhone/i ) || userAgent.match( /iPod/i ) )
{
return 'iOS';
}
else if( userAgent.match( /Android/i ) )
{
return 'Android';
}
else
{
return 'unknown';
}
}
Source: Detecting iOS / Android Operating system
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With