Facebook with user options with API version 2.9

I need to share the results of a quiz on facebook containing a custom title, image and description. It worked great before upgrading to version 2.9 on April 18th.

But it does not work with version 2.9. So am I missing something there? Or does Facebook not want us to share custom Facebook channels on our sites in 2017?

For my installation for a test Facebook, I strictly coded the Facebook Developer Documentation .

Facebook Changelog v2.9 says that parameter image, name, description and signature are no longer supported.

My fb api init:

<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '*APP-ID*',
      xfbml      : true,
      version    : 'v2.9'
    });
    FB.AppEvents.logPageView();
  };

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>

My fb-share call:

<script>
    $(document).ready(function() {
        $('#fbButton').click(function() {
            FB.ui({
                method: 'feed',
                link: '*URL*',
                caption: 'An example caption',
                picture: '*URL*/img/content4.jpg',
                name: 'An example name',
                description: 'An example description'
            }, function(response){});
        });
    });
</script>

facebook . , title ( , <head> <title>).

, .

, API- facebook 2.9?

? v2.9, facebook , ? ( ..)

( , og: tags)

+4
3

feed override og, :

FB.ui({
            method: 'share_open_graph',
            action_type: 'og.shares',
            action_properties: JSON.stringify({
                object : {
                   'og:url': 'http://astahdziq.in/', // your url to share
                   'og:title': 'Here my custom title',
                   'og:description': 'here custom description',
                   'og:image': 'http://apps.investis.com/Dharmendra/fbPOC/south.jpg'
                }
            })
            },
            // callback
            function(response) {
            if (response && !response.error_message) {
                // then get post content
                alert('successfully posted. Status id : '+response.post_id);
            } else {
                alert('Something went error.');
            }
        });

, .

+3

. :

www.facebook.com/sharer.php?caption= [] & = [] & = [] & = [-URL]

JavaScript window.open :

: https://jsfiddle.net/ovidiu_turean/mhuexvjL/

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
  window.open('https://www.facebook.com/sharer.php?title=ThisIsAtitle&description=ThisIsAdesc&u=https://www.google.ro&picture=https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-526588.jpg', 'Share', 'scrollbars=yes,resizable=yes,toolbar=no,menubar=no,scrollbars=no,location=no,directories=no,width=300, height=300, top=300, left=300' );
}
</script>
0

https://developers.facebook.com/docs/apps/changelog#v2_9

Custom parameters are no longer possible, shared URLs only take their data from the Open Graph tags on the website, Open Graph tags should be static for each URL. In addition, you can use ANY URL with ANY heading / description, which can be misleading.

0
source

Source: https://habr.com/ru/post/1676348/


All Articles