How do we manage to redirect users to the App Store from our download page

One of my client need to redirect user to appstore when user load the download page, this is because the client created few stickers with a QR code to download page of the web site. And then user need to click on app store icons to go the the appstore.

So to implement that we added following JS script to the download page

var location = window.location;
var fullUrl = location.href;

var userAgent = navigator.userAgent || navigator.vendor || window.opera;

// iOS detection
if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
  window.location.href = "apple app store link";
}
// Android detection
else if (/android/i.test(userAgent)) {
  window.location.href = "google play store link";
}
0
Subscribe to my newsletter

Read articles from Dileepa Chandima directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Dileepa Chandima
Dileepa Chandima

Experienced and self-motivated software engineer with a Computer Science and Engineering background having 6+ years of experience in Mobile Application and Web Application development. A dynamic personality, and motivated team player with sound leadership skills.