Users can share files from our app via twitter. The tweet includes a URL that points at our server, which detects whether the user is on a mobile device and redirects to a URL using our app's custom scheme so that the link opens in our app.
This works fine for desktop users, and for mobile users who have our app installed; but it doesn't work for mobile users who don't. So what we'd like to do instead is to show all users a page that contains a link which, when pressed, will open the app with the custom URL scheme if it is supported, and open a different URL where the user can download our app if not.
So what I'm looking for is an answer in HTML or JS that looks a bit like this:
<a href="ourapp://www.ourdomain.com/files/12345"
fallbackhref="http://www.ourdomain.com/buyourapp">Click to download</a>
Is that possible? If so, how do we do it?