Facebook页面选项卡 - “LIKE”按钮不重新加载页面

时间:2011-12-19 12:29:21

标签: facebook

我已经设置了一个简单的应用程序,可以在页面标签中运行。授权使用该应用程序后,仅查看基本信息,它会检查用户是否喜欢该页面。如果他们不这样做,则在继续操作之前要求您喜欢该页面 - 但是如果您在此时单击LIKE按钮则不会刷新页面,因此我在应用程序中看不到更改。用户处于挂起状态,必须再次单击页面选项卡才能继续,此时它会让您进入。如果您在启动前喜欢该页面,一切正常,LIKE按钮正常刷新页面。

这有什么理由吗?或者我错过了一个技巧 - 我应该添加自己的LIKE按钮吗?

帮助赞赏,因为我对Facebook应用程序真的很新。

编辑 - 如果有所作为,我正在使用Asp.Net C#。我发现很难找到任何好的文档,所以我尽可能地将它拼凑在一起,所以请原谅杂乱。这是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">
<head runat="server">
<title></title>
<script src="http://connect.facebook.net/en_US/all.js" type="text/javascript"></script>
<script type="text/javascript">
    FB.init({
        appId: '9999999999',
        status: true, // check login status
        cookie: true, // enable cookies to allow the server to access the session
        xfbml: true // parse XFBML
    });
</script>
<script type="text/javascript">
    window.fbAsyncInit = function () {
        FB.Canvas.setSize({ width: 520, height: 1300 });
    }
    // Do things that will sometimes call sizeChangeCallback()
    function sizeChangeCallback() {
        FB.Canvas.setSize({ width: 520, height: 1300 });
    }
</script>
</head>
<body style="width:520px;margin:0; padding:0; border:0;font-family:Arial;font-size:12px;">
<form id="form1" runat="server">
<div id="fb-root">
    <div id="intro" runat="server" style="width:520px;background-color:#FFFFFF;">
        Enter our competition<br />
        <br />
        <asp:Button ID="authorise" runat="server" Text="authorise" OnClick="Authorise_Click" />
    </div>
    <div id="voting" runat="server" visible="false" style="background-color:#FFFFFF;width:520px;padding:0px">
        <div id="notliked" runat="server" visible="false">
            You must LIKE our page before you can enter the competition
        </div>
        <div id="questions" runat="server" visible="false">
            <div id="week1" runat="server" visible="false">
                Q1 Q2 Q3    
            </div>
            <div id="week2" runat="server" visible="false">
                Q4 Q5 Q6
            </div>
            <div id="entereddiv" runat="server" visible="false">
                You have already entered this week's competition.
            </div>
        </div>

    </div>
    <div id="terms" runat="server" style="color:Black;font-size:11px;width:450px;">

    </div>  
</div>

</form>
<script type="text/javascript">

    window.fbAsyncInit = function () {
        FB.init({ appId: '9999999999', status: true, cookie: true, xfbml: true, oauth: false });

        // If like button pressed, refresh page
        FB.Event.subscribe('edge.create', function (response) { top.location = 'http://www.facebook.com/pages/MY_PAGE_NAME/PAGE_ID?sk=app_9999999999'; });

    };
    (function () {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol +
    '//connect.facebook.net/en_US/all.js';
        document.getElementById('fb-root').appendChild(e);
    } ());
</script>

</body>
</html>

1 个答案:

答案 0 :(得分:0)

我想我实际上已将其排除 - 我没有意识到我可以在没有用户授权应用程序的情况下获得isLiked属性。现在我已经切换了它,所以我首先检查signedrequest并让他们在寻求授权之前喜欢该页面。这让我解决了这个问题。

我仍然认为这是Facebook的一个错误,你不能这样做但是对于这个项目,这个解决方案会做。