2013-03-14 79 views
0

我有我的网站和Facebook连接的Facebook应用程序正常工作。我在用户的墙上选择了该帖子,但在墙上发帖发生为弹出窗口,大多数浏览器都会自动禁用弹出窗口。所以墙贴不工作,因为我想要它,因为大多数人不启用弹出窗口。是否有任何解决方案,使这张贴作为不弹出。Facebook连接墙发布仅用于弹出窗口。如何改变?

,我已经使用了FB连接的代码是

<script> 

window.fbAsyncInit = function() 
{ 
    FB.init({ 
     appId : '', 
     status : true, // check login status 
     cookie : true, // enable cookies to allow the server to access the session 
     xfbml : true , // parse XFBML 
     oauth : true // Enable oauth authentication 
    }); 

FB.login(function(response) 
{ 
    if (response.authResponse) 
    { 

     FB.api('/me/feed', 'post', 
       { 
        message  : "", 
        link  : '', 
        picture  : "", 
        name  : '', 
        description : '' 

      }, 
      function(response) { 
       showLoader(false); 

       if (!response || response.error) { 
        alert('Error occured'); 
       } else { 
        alert('Post ID: ' + response.id); 
       } 
      }); 
    } 

}, { scope : 'publish_stream' }); 
}; 

</script> 

<!-- FACEBOOK -->   
<div id="fb-root"></div> 
<script> 
(function() { 
var e = document.createElement('script'); 
// replacing with an older version until FB fixes the cancel-login bug 
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; 
    //e.src = 'scripts/all.js'; 
    e.async = true; 
    document.getElementById('fb-root').appendChild(e); 
    }()); 
</script> 
<!-- END-OF-FACEBOOK --> 

回答

2

这不是打开弹出窗口(FB.api是一个后台方法,但它永远不会打开一个弹出)的发布 - 但FB.login电话。

正如在文档中提到的,不应该在页面加载时调用此方法,而应该在显式用户交互(即,单击登录按钮)上调用此方法。当前浏览器中的弹出窗口阻止程序的默认配置不会阻止用户交互时出现的弹出窗口。

如果这还不够好,那么你可以使用的登录对话框的直接URL的版本,这将登录后导致用户的Facebook,并返回到你的页面:https://developers.facebook.com/docs/howtos/login/client-side-without-js-sdk/#step2

相关问题