How to detect the device that user is using in InstaPage and redirect them to different URL after they fill-in the form?
Example:
Settings > HTML/CSS > Header
<script src="//cdnjs.cloudflare.com/ajax/libs/mobile-detect/1.3.6/mobile-detect.min.js"></script>
Settings > Javascript > Body
$(function() {
var md = new MobileDetect(window.navigator.userAgent);
var ios_url = "https://itunes.apple.com/...";
var android_url = "https://play.google.com/...";
var fallback_url = "https://www.example.com/";
if (md.os() == "iOS") {
console.log("iOS");
jQuery('form').find('input[name="redirect"]').val(ios_url);
} else if (md.os() == "AndroidOS") {
console.log("AndroidOS");
jQuery('form').find('input[name="redirect"]').val(android_url);
} else {
console.log("Desktop");
jQuery('form').find('input[name="redirect"]').val(fallback_url);
}
console.log(jQuery('form').find('input[name="redirect"]').val());
});
That's all.
Thank you to mobile-detect.js for making this happen.