Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
849 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...