[英]How to open Facebook App from browser directly to share view
EDIT : What are all the custom URL schemes supported by the Facebook iPhone app? 编辑 : Facebook iPhone应用程序支持的所有自定义URL方案是什么?
I have got a web page where I got a Facebook
sharing button. 我有一个网页,我有一个
Facebook
分享按钮。
Now, I am dealing with iPhone
users with already installed Facebook App
. 现在,我正在与已安装
Facebook App
iPhone
用户打交道。
When the user clicks share
on the page I do not want to open Facebook page, I would like to open the Facebook App for him. 当用户点击页面上的
share
我不想打开Facebook页面时,我想为他打开Facebook App。
I have already added a piece of code: 我已经添加了一段代码:
<a href="fb://" id="shareButton">Open FB Profile</a>
This piece of code will open for user Facebook App. 这段代码将为用户Facebook App打开。 I would like to open the App directly with sharing view.
我想直接用共享视图打开App。 Let's say I would like to open the App with link
https://stackoverflow.com/
and waiting for user confirmation (or even just post it without any user contribution). 假设我想通过链接
https://stackoverflow.com/
打开应用程序并等待用户确认(甚至只是发布它而不需要任何用户贡献)。
I found a page with IPhone URL Schemes but there is not something like fb://share
. 我找到了一个包含IPhone URL Schemes的页面,但是没有像
fb://share
这样的东西。
Has someone already implemented this way of sharing data with Facebook App? 有人已经实现了这种与Facebook App共享数据的方式吗?
I will be really happy to see your solutions and, if it is possible, a piece of code. 我很高兴看到您的解决方案,如果可能的话,我会很高兴看到一段代码。
I tried to use 我试着用
<a href="fb://post?message=helloworld" id="shareButton">Open FB Profile</a>
but nothing happens - it still opens Facebook App but there is not any post on my timeline. 但没有任何反应 - 它仍然打开Facebook App但我的时间线上没有任何帖子。 In fact, even
fb://map
opens the Facebook App in main view... 事实上,甚至
fb://map
也会在主视图中打开Facebook App ...
Thank you in advance 先感谢您
EDIT: 编辑:
I tried to use another way to publish something but it is not what I really want to do. 我试图用另一种方式发布一些东西,但这不是我真正想做的事情。 I would like to open Facebook App with dialog and ask user to share something(in fact, to accept what I want to share).
我想用对话框打开Facebook App,并要求用户分享一些东西(事实上,接受我想要分享的内容)。
With the Graph API Explorer I am able to do a GET
/ POST
to the current Facebook profile. 使用Graph API Explorer,我可以对当前的Facebook个人资料进行
GET
/ POST
。 I wrote also an easy JS script which does the same action: 我还写了一个简单的JS脚本,它执行相同的操作:
<script type="text/javascript">
function publishOnFacebook() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
console.log(xmlhttp.status);
}
}
xmlhttp.open("POST", "https://graph.facebook.com/me/feed?" +
"message=https://stackoverflow.com/q/25313299/1021970" +
"&access_token=my_token", true);
xmlhttp.send();
}
</script>
It works, but it is not exactly what I want to. 它有效,但它不是我想要的。 It looks like this:
它看起来像这样:
without any picture or preview. 没有任何图片或预览。
The Facebook app does not officially support deep linking so what you are trying to do is not possible (right now). Facebook应用程序不正式支持深层链接,所以你想要做的事情是不可能的(现在)。
A bigger problem I see, how will you check if the Facebook app is already installed? 我看到一个更大的问题,你如何检查Facebook应用程序是否已经安装? Mobile Safari does not provide such functionality and trying to open an URL scheme the iOS device does not understand will lead to an ugly error message, just sayin'...
Mobile Safari不提供此类功能,尝试打开iOS设备无法理解的URL方案会导致丑陋的错误消息,只是说'...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.