问题
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!
回答1:
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.');
}
});
回答2:
Did you use FB debugger to test your link is everything correct? https://developers.facebook.com/tools/debug
来源:https://stackoverflow.com/questions/11315195/why-is-open-graph-built-in-like-not-working-anymore