如何从浏览器直接打开Facebook App分享视图 [英] How to open Facebook App from browser directly to share view

查看:1142
本文介绍了如何从浏览器直接打开Facebook App分享视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑 Facebook iPhone应用程序支持的所有自定义URL方案?



我有一个网页,我有一个 Facebook 分享按钮。



现在,我正在处理已经安装 Facebook App iPhone 用户。



当用户点击页面上的共享时,我不想打开Facebook页面,我想打开Facebook应用程序我已经添加了一段代码:

 < a href =fb://id =shareButton>打开FB Profile< / a> 

这段代码将为用户Facebook App打开。我想直接使用共享视图打开App。假设我想打开应用程序,链接 https://stackoverflow.com/ 等待用户确认(甚至只是发布没有任何用户贡献)。 / p>

我发现一个页面包含 IPhone URL方案< a>但没有像 fb:// share



有人已经实现了这种共享方式数据与Facebook应用程序?



我将很高兴看到您的解决方案,如果可能,一段代码。



我试图使用

 < a href =fb:// post?message = helloworld id =shareButton>打开FB Profile< / a> 

但没有任何反应 - 它仍然打开Facebook应用程序,但我的时间轴上没有任何帖子。事实上,即使 fb:// map 在主视图中打开Facebook应用程序...



谢谢提前






编辑:



我试图用另外一种方式发布一些东西,但这不是我真正想要做的。我想通过对话框打开Facebook应用程序,并要求用户分享一些东西(实际上是接受我想要分享的内容)。



使用 Graph API Explorer 我可以执行 GET / POST 到当前的Facebook个人资料。我写了一个简单的JS脚本,执行相同的操作:

 < script type =text / javascript> 
函数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>

它的工作原理,但不完全是我想要的。看起来像这样:





没有任何图片或预览。

解决方案

Facebook应用程序不正式支持深层链接,所以您尝试做的是不可能的(现在)。



我看到更大的问题,您将如何检查Facebook应用程序是否已经安装?移动Safari不提供这样的功能,并尝试打开一个iOS设备不明白的URL方案将导致一个丑陋的错误消息,只是sayin'...


EDIT: What are all the custom URL schemes supported by the Facebook iPhone app?

I have got a web page where I got a Facebook sharing button.

Now, I am dealing with iPhone users with already installed Facebook App.

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.

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. I would like to open the App directly with sharing view. 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).

I found a page with IPhone URL Schemes but there is not something like fb://share.

Has someone already implemented this way of sharing data with 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. In fact, even fb://map opens the Facebook App in main view...

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

With the Graph API Explorer I am able to do a GET/POST to the current Facebook profile. I wrote also an easy JS script which does the same action:

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

A bigger problem I see, how will you check if the Facebook app is already installed? 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'...

这篇关于如何从浏览器直接打开Facebook App分享视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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