2013-03-21 64 views
0

截至目前,该JavaScript打开:Facebook发布到饲料中的窗口

<script> 

    FB.init({appId: "123456789", status: true, cookie: true, xfbml:true }); 

    function postToFeed(description) { 

    var obj = { 
     method: 'feed', 
     redirect_uri: 'http://thelivesite.com/', 
     link: 'https://thelivesite.com/', 
     picture: 'https://www.thelivesite.com/static/images/logo.png', 
     name: 'TheLiveSite', 
     caption: 'Here's a caption', 
     description: description, 
    }; 


    function callback(response) { 
     document.getElementById('msg').innerHTML = "Post ID: " + response['post_id']; 
    } 

    FB.ui(obj, callback); 
    } 

</script> 

<div id='fb-root'></div> 

<p style="position: absolute;"> 
    <a onclick='postToFeed("{{ item.title }}."); return false;'>Share</a> 
</p> 
<p id='msg'></p> 

呈现这样一个对话框:

enter image description here

我有什么做的,使它是这样的弹出窗口对话框:

enter image description here

+0

根据您的用户界面,Facebook在手机上的支持。欲了解更多详情,请访问https://developers.facebook.com/docs/reference/dialogs/feed/ – Amit 2013-03-21 19:21:52

回答

3

加入:display: "popup

var obj = { 
    method: 'feed', 
    redirect_uri: 'http://thelivesite.com/', 
    link: 'https://thelivesite.com/', 
    picture: 'https://www.thelivesite.com/static/images/logo.png', 
    name: 'TheLiveSite', 
    caption: "Here's a caption", 
    description: description, 
    display: "popup" 
}; 
+0

Dude。你是一个拯救生命的人。这工作完美。 – Modelesq 2013-03-21 19:27:21

+0

非常感谢,很高兴我能帮助你。顺便说一句,如果这个答案适合你标记为未来观众的正确答案 – 2013-03-21 19:29:59

+1

时间限制:P YOu回应如此之快! – Modelesq 2013-03-21 19:32:49