Facebook stops custom parameters (image,title,description) through FB.ui?

断了今生、忘了曾经 提交于 2019-12-18 02:58:09

问题


Today I check my site and this code not working:

<script>
...
    FB.ui({
            display: 'dialog',
            method: 'share_open_graph',
            action_type: 'og.likes',
            hashtag: '#Testing',
            action_properties: JSON.stringify({
                object: {
                    'og:image': img,
                    'og:image:secure_url': img,
                    'og:image:type': 'image/jpeg',
                    'og:image:width': w,
                    'og:image:height': h,
                    'og:image:alt': img,
                    'og:url': link,
                    'og:title': title,
                    'og:description': desc,
                    'fb:admins': fbadmin
                }
            })
        },
        function(response) {
            if (typeof response != 'undefined') {
                //Success
            } else {
                //Not Success;
            }
        });
</script>

With this code, from https://developers.facebook.com/docs/sharing/reference/share-dialog/ :

FB.ui({
  method: 'share',
  href: link,
}, function(response){});

Facebook sees and takes a picture of the link, but not the picture that I need share. Apparently FB changed policy of sharing.

How to now I can customize paramateres for sharing? How to I can set custom image if this link has a lot of pictures?

Edited

Without og:url it worked again, but after click successfully shared content on facebook, redirected on board url, not on url that I need share.


回答1:


I've been having a hard time with this today as well and the solution for me was to remove the 'og:url': link from the open graph object and then it worked again. I only had url, title, description and image though.



来源:https://stackoverflow.com/questions/55870767/facebook-stops-custom-parameters-image-title-description-through-fb-ui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!