简体   繁体   中英

Facebook App links(Deep links) not working on mobile browsers

I run into problem linking app with facebook sharing. I have the following meta tags for the web page. What I want is when user share the page to facebook, and when the post is clicked. It should trigger an intent which launches the native app.

The weird thing is when I click on the facebook share on mobile chrome/safari, it ignores the app link and goes straight to that web page. Inspecting facebook's html, the a tag is linking to the webpage without any mentioning of the app link.

However, when I use facebook native app on android, it does trigger an intent to launch my app. That said, facebook native app on ios doesn't work the same (goes to the web page).

The app link shows just fine on the facebook open graph inspector. It seems it always uses my og:url (I tried using if statement as below to not render the tag, but it still infers the url somehow).

My question why is facebook web on mobile uses the web url instead of the app link. Is there a way to do this ?

<% if @app_links%>
  <meta property="al:ios:url" content="<%= @app_links[:deep_link] %>" />
  <meta property="al:ios:app_store_id" content="<%= @app_links[:ios][:app_store_id] %>" />
  <meta property="al:ios:app_name" content="<%= @app_links[:app_name] %>" />
  <meta property="al:android:url" content="<%= @app_links[:deep_link] %>">
  <meta property="al:android:package" content="<%= @app_links[:android][:package] %>">
  <meta property="al:android:app_name" content="<%= @creation_og_deep_link[:app_name] %>">

  <!--fallback-->
  <meta property="al:web:should_fallback" content="false" />
<% else %>
   <meta property="og:url" content="<%= page_url %>"/>
<% end %>

This is the expected behavior

There is no way to implement App Links behavior in a website context. In order to properly handle the app not installed situation with fallbacks to the App/Play Store or specified webpage, all the current implementations are inside third-party apps. In other words, even if Facebook wanted to redirect to an app using App Links data from their mobile website, they wouldn't be able to do it smoothly because none of the major mobile web browser apps (Safari, Chrome, etc.) have implemented the App Links standard and are unlikely to do so.

As you've noted, the native Facebook on Android does still properly implement App Links. However, the native app on iOS has not done so for some time now, which is a known issue that Facebook has essentially written off as wontfix . It's unfortunate they haven't been more transparent about this change, because there is quite a bit of confusion about it.

But you can work around it

Services like Branch.io (full disclosure: I am on the team) get around this by implementing a judicious combination of App Links, URI schemes, and iOS Universal Links. If you just want to be able to post a link that goes into your app when it is installed and otherwise goes to a webpage (or the App/Play Store), then Branch links are definitely your simplest solution.

Branch link routing logic

分支链路路由逻辑

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM