简体   繁体   English

限制Facebook分享对话框的大小

[英]Limit Facebook Share dialog Size

How can I limit the Facebook share dialog size. 如何限制Facebook分享对话框的大小。

I'm using the Javascript SDK, this is my test code. 我正在使用Javascript SDK,这是我的测试代码。

Test site is here . 测试地点在这里 CLick the 'contact' button to envoke the dialog. 单击“联系人”按钮以调用对话框。 The popup resizes to use a very large image size. 弹出窗口将调整大小以使用非常大的图像大小。 This is the image specified in the OG:Image tags, but I'd prefer the dialog box to use a small image, and be a set dimension. 这是在OG:Image标记中指定的图像,但我希望对话框使用小图像,并设置尺寸。

Any ideas? 有任何想法吗?

        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.');
           }
         }
        );

You can manually pass an image to the dialog by adding picture to the FB.ui function, so it doesn't use the image specified in the OG tags. 您可以通过将picture添加到FB.ui函数来手动将图像传递到对话框,因此它不使用OG标记中指定的图像。 You can then set the URL to the smaller image you want to use. 然后,您可以将URL设置为要使用的较小图像。

Example: 例:

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.');
        }
     }
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM