2013-03-21 43 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