在Facebook iFrame标签页中请求许可

时间:2011-02-22 22:08:37

标签: javascript facebook

嗯,这不行。

FB.Connect.showPermissionDialog("email,offline_access", function(perms) {
    if (!perms) {
        document.location.href='YouNeedToAuthorize.html';
    } else {
    document.location.href='homePage.html';
    }
});

FB.Connect未定义

1 个答案:

答案 0 :(得分:-1)

尝试

this.FB.Connect.showPermissionDialog("email,offline_access", function(perms) {
    if (!perms) {
        document.location.href='YouNeedToAuthorize.html';
    } else {
    document.location.href='homePage.html';
    }
});

另外,请确保在页面末尾显示此内容。

  <div id="FB_HiddenIFrameContainer"
       style="display:none; position:absolute; left:-100px;top:-100px; width:0; height: 0;">
    <script
    src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"
    type="text/javascript"></script>
    <script type="text/javascript">
    FB_RequireFeatures(["CanvasUtil","XFBML"], function(){
    FB.Facebook.init( "{{ API_KEY }}", "/fb/xd");
    FB.XdComm.Server.init("/fb/xd");
    FB.CanvasClient.startTimerToSizeToContent(); });
    </script>
  </div>