为什么Open Graph内置像不工作? [英] Why is Open Graph Built-In Like not working anymore?

查看:131
本文介绍了为什么Open Graph内置像不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个Facebook应用程序和开放式图形操作Likefor Object(这可能是全球类似于任何类型信息的操作)。



I只需要在近期活动中获取此格式,请使用简单的按钮:USERNAME在APPNAME上喜欢OG:TITLE



使用以下代码:



< meta property =fb:app_idcontent =**/>
< meta property =og:typecontent =article/>
< meta property =og:urlcontent =**/>
< meta property =og:titlecontent =**/>
< meta property =og:imagecontent =**/> ;



并加载SDK,如下所示:



< script>(function(d,s,id){
var js,fjs = d.getElementsByTagName(s )[0];
if(d.getElementById(id))return;
js = d.createElement(s); js.id = id;
js.src =//connect.facebook.net/es_LA/all.js#xfbml=1&appId=*******;
fjs.parentNode.insertBefore(js,fjs);
}(document,'script','facebook-jssdk'));

< / script>



它工作了一天,然后停止死亡!



我想知道这是否有任何修复?我应该怎么做,或者可能是错的?



感谢大家的时间!

解决方案

您可以使用javascript sdk来喜欢网页或对象。
这里是示例代码。
请注意,您应该通过授权从用户处获取。

  FB.api(
'/ me /g.like',
'post',
{'object':'http://www.yourwebpage.com/',
'access_token':'aaaa'},
函数(响应){
if(!response || response.error){
alert('你不能喜欢');
} else {
alert 你喜欢它);
}
});


I've created a Facebook App and Open Graph Action "Like" for Object (this might be the global like action for any kind of information).

I just want to get this format on Recent Activity, using a simple Like Button: "USERNAME" likes "OG:TITLE" on APPNAME

Im using this code:

<meta property="fb:app_id" content="**" /> <meta property="og:type" content="article" /> <meta property="og:url" content="**" /> <meta property="og:title" content="**" /> <meta property="og:image" content="**" />

And loading the SDK like this:

<script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1&appId=*******"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));
</script>

It worked for a day and then stopped and die!

I would like to know if theres any kind of fix for this? What should i do, or what could be wrong?

Thanks to everyone for your time!

解决方案

You can use javascript sdk for liking web pages or objects. Here is sample code. Note that you should get accesstoken from user via authorization.

FB.api(
        '/me/og.like',
        'post',
        { 'object': 'http://www.yourwebpage.com/',
        'access_token': 'aaaa'  },
        function(response) {
           if (!response || response.error) {
              alert('you couldnt like.');
           } else {
              alert('you liked it.');
           }
        });

这篇关于为什么Open Graph内置像不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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