I have three buttons on my website, that link to facebook, twitter & vk.com pages. I want to open native app, if it is installed on user device. Otherwise, i want url fallback to be opened.
First of all, i tried to use native app schemes directly with deep-link.js plugin. But, when i tried to open native app url scheme, when native app was not installed, Safari has shown an error, but opened url fallback page finally. Default android browser said that he does not know how to handle such url scheme:
<a class="btn btn-primary" href="https://www.facebook.com/warpcompany" data-app-ios="fb://profile/838619192839881" data-app-android="fb://page/838619192839881">Facebook</a>
It is still possible, but on newer versions of the Android default browser you have to use intents instead of just trying to open the deep link. For example replace your
This will fallback to Google play by default, but you can override the fallback adding a
The fallback should be url encoded.
Of course you'll have issues if the user is not on an Android phone or with an old version of the default browser (or strange browser). You can setup a bunch of conditions and replace your HTML with the correct code for each case.
I work on HOKO, which is a free, simple and easy way to have everything working on Android and iPhone and we've done all the dirty work around this. You can rather use it or just drop us a line and we'll help you out.