是否可以在Android / iOS /手机上创建一个“在Facebook上分享”链接,打开本机Facebook应用程序,而不是Web共享对话框? [英] Is it possible to generate a 'share on Facebook' link that opens the native Facebook App on Android/iOS/mobile instead of the web share dialog?

查看:438
本文介绍了是否可以在Android / iOS /手机上创建一个“在Facebook上分享”链接,打开本机Facebook应用程序,而不是Web共享对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在本地应用程序中打开共享对话框的网站上的上分享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用户正在使用本机应用程序,因此未在其浏览器上登录。因此,Web共享对话框提示他们输入他们的用户凭据 - 这可能导致他们完全不共享。

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 official 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.

使用官方网络共享对话框没有任何先决条件的最简单的方法就是获得此功能。 ,是链接到这个URL:

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_TO_SHARE和RETURN_URL替换为适当的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.

在sidenote上:我会高度阻止您使用Facebook应用程序注册的未正式记录的URL方案。如果从安装了Facebook应用程序的设备访问了网站,那么它们可能会工作,那么在没有安装Facebook应用程序的设备上,尤其是任何PC或Macs,它们将成为死链接或奇怪的浏览器警告。即使您检查所有这些情况,Facebook 已经改变了他们的网址计划,并且可能会在任何时候再次这样做,打破你的链接,或者 - 可能更糟 - 导致未定义的行为。

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 an installed Facebook app, they become dead links or weird browser warnings on devices without the 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.

这篇关于是否可以在Android / iOS /手机上创建一个“在Facebook上分享”链接,打开本机Facebook应用程序,而不是Web共享对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆