是否有可能生成链接“在Facebook上分享”打开本机的Facebook应用程序在Android / iOS的/移动,而不是Web共享对话框?有可能、本机、对话框、应用程序

2023-09-12 10:16:21 作者:你在就很好了

是否有可能有打开的本机应用程序共享对话框中的 Facebook的链接在一个网站上的共享

Is it possible to have a share on Facebook link on a website that opens the share dialog in the native App?

当前的行为:

现在点击Facebook分享链接打开基于Web的份额对话,这是不好的,因为大多数手机的Facebook用户使用的是本机应用程序,因此不会记录在自己的浏览器。因此网络共享对话框会提示他们输入自己的用户凭据 - 这可能会导致他们毕竟不是共享

Right now clicking the Facebook share link opens the web-based share dialog, which is bad since most mobile Facebook user are using the native app, thus are not logged in on their browsers. Consequently the web share dialog prompts them to input their user credentials - which might lead them to not share after all.

理想的行为:

点击Facebook上链接的比例导致了原生的Facebook应用程序共享对话框,用户已经登录。

Clicking the share on Facebook link leads to the share dialog in the native Facebook app, where the user is already signed in.

在此先感谢您的帮助!

推荐答案

截至目前,有没有原生的方式以实现这一目标。它的可以的是由Facebook的实施虽然,转发使用他们的自定义URL方案的Web共享对话框。所以,如果你使用正式文件的方式以打开此对话框,你会得到这个功能没有进一步的一旦它成为可用的变化。

As of now, there is no native way to achieve this. It could be implemented by Facebook though, forwarding their web share dialog using their custom URL scheme. So if you use the officially documented way to open this dialog you would get this functionality with no further changes as soon as it becomes available.

使用官方Web共享对话框最简单的方法,没有任何prerequisites ,是链接到这个网址:

The easiest way to use the official web share dialog, without any prerequisites, is to link to this url:

https://www.facebook.com/dialog/share?
    app_id=145634995501895
    &display=popup
    &href=URL_TO_SHARE
    &redirect_uri=RETURN_URL

在这里你有正确的URL恩codeD值替换URL_TO_SHARE和RETURN_URL。或者您包括Facebook的JS-SDK 并使用经典的分享按钮或分享关于网络。

where you replace URL_TO_SHARE and RETURN_URL with the proper URL-encoded values. Or you include the Facebook JS-SDK and use the classical share button or other ways described in sharing on the web.

只是为了完整性:在iOS和Android原生的应用程序,可以链接到Facebook应用程序直接,如果用户安装了Facebook应用程序。请参阅从的iOS 或的 Android的。由于这并非总是如此,你必须检查使用各自平台的具体Facebook的SDK和后备基于web的对话也是如此。

Just for completeness: In native apps on iOS and Android it is possible to link to the Facebook app directly, if the user has the Facebook app installed. See sharing from iOS or android. As this is not always the case you have to check using the respective platform's specific Facebook SDK and fallback to the web based dialog as well.

在阿里纳斯:我会极力利用由Facebook应用程序注册的没有正式记录的URL方案气馁。而如果该网站是由安装Facebook应用程序的设备访问他们可能工作,他们成为死链接或安装在设备怪异的浏览器警告,而不Facebook的应用程序,特别是任何PC或Mac。即使你检查所有这些情况下,Facebook的has已经改变了他们的网址,计划,并可能会再次这样做在任何时间,打破你的链接(S)或 - 也许更糟 - 导致不确定的行为

On a sidenote: I would highly discourage you from using the not officially documented URL-schemes registered by the Facebook app. While they might work if the website is visited from a device with installed Facebook app, they become dead links or weird browser warnings on devices without Facebook app installed, especially any PCs or Macs. Even if you check for all these cases, Facebook has already changed their URL-Schemes and might do so again at any time, breaking your link(s) or - maybe worse - leading to undefined behavior.