限制Facebook共享对话框大小

时间:2013-10-01 23:05:52

标签: javascript facebook dialog

如何限制Facebook共享对话框的大小。

我正在使用Javascript SDK,这是我的测试代码。

测试网站为here。点击“联系人”按钮以调出对话框。弹出窗口调整大小以使用非常大的图像大小。这是OG:Image标签中指定的图像,但我更喜欢使用对话框来使用小图像,并且是设置尺寸。

有什么想法吗?

        FB.ui(
         {
           method: 'feed',
           name: $(document).find("title").text(),
           link: location.href
         },
         function(response) {
           if (response && response.post_id) {
             alert('Post was published.');
           } else {
             alert('Post was not published.');
           }
         }
        );

1 个答案:

答案 0 :(得分:1)

您可以通过将picture添加到FB.ui函数手动将图像传递到对话框,因此它不会使用OG标记中指定的图像。然后,您可以将URL设置为您要使用的较小图像。

示例:

FB.ui( {
        method: 'feed',
        name: $(document).find("title").text(),
        link: location.href,
        picture: '{url_to_picture}'
     }, function(response) {
        if (response && response.post_id) {
            alert('Post was published.');
        } else {
            alert('Post was not published.');
        }
     }
);