Facebook帖子要在一个窗口中打开

时间:2013-03-21 19:15:56

标签: javascript facebook facebook-javascript-sdk feed

截至目前,这个javascript:

<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

1 个答案:

答案 0 :(得分: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"
};