5

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.

Akber Iqbal
  • 14,487
  • 12
  • 48
  • 70
Erekle M.
  • 105
  • 8
  • ref (1): https://stackoverflow.com/questions/55901886/facebook-api-share-open-graph-issues ref (2): https://stackoverflow.com/questions/55930183/javascript-facebook-share-dialog-with-open-graph-ogurl-not-working ref (3): https://stackoverflow.com/questions/56006196/how-do-i-share-dynamic-content-using-facebook-sdk-in-angularjs ... can anyone share this annonucement from FB? – Akber Iqbal May 29 '19 at 08:08

1 Answers1

0

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.

murphyfa
  • 38
  • 4
  • Yes, without **og:url** it worked again, but after click successfully shared content on facebook, redirected on board url: https://example.com but shared picture and other content is not there :( – Erekle M. Apr 27 '19 at 05:59