script
<script language="JavaScript">
/**
* Determine the mobile operating system.
* This function returns one of 'iOS', 'Android', 'Windows Phone', or 'unknown'.
*
* @returns {String}
*/
function getMobileOperatingSystem() {
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
// Windows Phone must come first because its UA also contains "Android"
if (/windows phone/i.test(userAgent)) {
return "Windows Phone";
}
if (/android/i.test(userAgent)) {
return "Android";
}
// iOS detection from: http://stackoverflow.com/a/9039885/177710
if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
return "iOS";
}
return "unknown";
}
var storeUrl = "";
var os = getMobileOperatingSystem();
if (os == 'iOS') {
storeUrl = "https://apps.apple.com/it/app/visit-sabbioneta/id6449699824";
location.href = storeUrl;
}
else if (os == 'Android') {
storeUrl = "https://play.google.com/store/apps/details?id=it.fabbricadigitale.sabbioneta";
location.href = storeUrl;
}
if (os == 'iOS' || os == 'Android') {
window.setTimeout(function() {
document.getElementById("storeLink").href = storeUrl;
document.getElementById("loader").classList.add("hide");
document.getElementById("timeoutMsg").classList.remove("hide");
}, 3000);
}
</script>