相关疑难解决方法(0)

如何使用Facebook的API检查用户是否喜欢我的Facebook页面或URL

我想我会疯了.我无法让它发挥作用.
我只想检查用户是否喜欢我的iFrame应用程序中的javascript页面.

FB.api({
    method:     "pages.isFan",
    page_id:        my_page_id,
},  function(response) {
        console.log(response);
        if(response){
            alert('You Likey');
        } else {
            alert('You not Likey :(');
        }
    }
);
Run Code Online (Sandbox Code Playgroud)

返回:False
但我是我的页面的粉丝,所以不应该返回true?!

javascript facebook facebook-graph-api

101
推荐指数
4
解决办法
15万
查看次数

Facebook如何检查用户是否喜欢页面和显示内容?

我正在尝试创建一个Facebook iFrame应用程序.应用程序应首先显示图像,如果用户喜欢该页面,他将可以访问某些内容.

我使用RoR,因此我无法使用Facebook PhP SDK.

当用户不喜欢该页面时,这是我的iFrame HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
body {
width:520px;
margin:0; padding:0; border:0;
font-family: verdana;
background:url(repeat.png) repeat;
margin-bottom:10px;
}
p, h1 {width:450px; margin-left:50px; color:#FFF;}
p {font-size:11px;}
</style>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
</head>
<body>
<div id="container">
<img src="welcome.png" alt="Frontimg">
</div>
Run Code Online (Sandbox Code Playgroud)

并且,如果用户喜欢该页面:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
body …
Run Code Online (Sandbox Code Playgroud)

javascript jquery facebook ruby-on-rails ruby-on-rails-3

53
推荐指数
3
解决办法
10万
查看次数