One QR Code for Two App Stores: A Tiny Redirect Page
My website has an "Install with QR" button for people who visit from a computer. It used to be simple, because every app was Android-only. Then the apps arrived on the iPhone too, and I had to decide what that button should show. I ended up with one QR code that works for both stores. Here is how it works and what it costs. The question: what does the button show now? Until recently the QR code…
The website owner created a single QR code that redirects users to a short URL, which then directs them to the appropriate app store—Google Play or the App Store—based on the device scanning the code. This eliminates the need for separate QR codes for each store, as the QR code is only visible on desktop computers and thus points to a redirect page specific to the device scanning it.
The redirect page reads the user agent to determine if the user is on an iOS device (iPhone, iPad, or iPod) or an Android device. For iOS devices, the page forces a redirect to the correct app store using the location.replace method, ensuring that Android devices continue to open the original Google Play link with a referrer parameter for tracking installs.
Desktop users or browsers without JavaScript receive a direct display of both Google Play and App Store badges with links back to the app's page on the website. The QR code has been shortened to reduce the number of characters, making it easier to scan with a phone camera, especially when viewed on a laptop screen. The website owner only creates redirect pages for apps that have an iPhone version, while Android-only apps continue to have a direct Google Play QR code.
While this system solves the problem of needing separate QR codes for each app store, it relies on JavaScript and adds an extra step for users who do not have it enabled.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.