简体   繁体   中英

Limit Facebook Share dialog Size

How can I limit the Facebook share dialog size.

I'm using the Javascript SDK, this is my test code.

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.

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. You can then set the URL to the smaller image you want to use.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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