Reputation: 3566
To give you some context: The goal is to share objects from our apps via links (deeplink), however, when the link is sent on Facebook/Messenger/Instagram and when we try to open it, it does not open the application because these applications use an internal browser which directly redirects to a web view (and not to our app), to overcome this problem we would like to put a button on the webview that would allow opening the application.
When sharing the link on other apps like for example: Messages or Notes, the universal link works correctly
We are trying to open a universal link from an app that does not belong to us without opening it in a webview, or alternatively find a way for the webview to open the universal link via a JS button. Without going through Firebase Dynamic Links, nor through a custom scheme.
We are trying to fix this issue on iOS, our app is made with Dart & Flutter, but we followed the native iOS way for universal links. (Registering the domain in the associated domain in XCode, adding the .well-known/apple-app-site-association
file in an HTTPS secure webspace under the root of our domain)
Upvotes: 3
Views: 1087
Reputation: 330
Also stuck on this. The only solution I've seen so far (haven't tried it yet), is to attempt to do a URL scheme link when you detect that you're inside a non-deeplinkable web view like Instagram.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script>
window.onload = function () {
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
if (isMobile) {
const isUserComingFromInstagramReferral = document.referrer.includes("instagram");
if (isUserComingFromInstagramReferral) {
const url = window.location.href.replace("https://your-domain", "your-app-scheme://")
window.location = url;
setTimeout(function () {
// wait a second and then to go App Store or your Website
// if the user hasn't installed yet.
window.location = "your-web-site-or-app-store-link";
}, 1000);
}
}
}
</script>
</head>
<body>
<p>Hello, World!</p>
<img src="./public/your-app-icon.png" alt="" width="300" height="300"/>
</body>
</html>
Update: another solution, which isn't automatic, is opening a page in the web view that has a deep link inside of it that they can tap. So they click your deep link, it opens in the Instagram web view, then you display a button in the web view that's a deep link to your app (note that it has to be a different subdomain/domain than the domain of the web view you're presenting). https://stackoverflow.com/a/42357142/2611730. It's incredibly frustrating that evil tech is destroying these OS level APIs, causing us to have to come up with all of these edge cases, so that they can track every single thing that a user does on their phone. Apple/Google ought to just make it a policy requirement that deep links work in these company's web views.
Upvotes: 0