Set text in API share facebook

0

I have a script to share content on Facebook is working fine just wanted to add text that the system generates automatically when you click the share button.

Example:

IwantedthatwhereitsaysDizalgosobreisto…wasanalreadypredefinedtext.Isitpossibletodothis?

Codeused

<script>FB.init({appId:"", status: true, cookie: true, xfbml:true });

  function postToFeed(description) {

    var obj = {
        method: "feed",
        message     : "Vê este comentário sobre '.$row_estabelecimento->titulo.' no @SabeOnde",
        link        : "'.$row_estabelecimento->link_site.'",
        picture     : "http://sabeonde.pt/gtm/anexos/capa/'.$row_estabelecimento_anexo->id_anexo.'.'.$row_estabelecimento_anexo->tipo.'",
        name        : "'.$row_estabelecimento->titulo.' | SabeOnde",
        description : "'.$row_posts->opiniao.'",
        display: "popup"
    };

    function callback(response) {
      document.getElementById("msg").innerHTML = "Post ID: " + response["post_id"];
    }

    FB.ui(obj, callback);
  }
</script>
    
asked by anonymous 09.03.2015 / 22:43

1 answer

1

You can not do this using sharer.php, but you can do something similar using API dialog.

EXAMPLE:

APP_ID=FacebookappIdentifier"http://www.THEPAGE.com" = This would be my domain

    $('#share_button').bind('click', function(e){
            e.preventDefault();
            var title = 'Title I want';
            var im_url = 'url_to_image';
            url = "https://www.facebook.com/dialog/feed?app_id=APP_ID" + 
                        "&link=" + encodeURIComponent("http://www.THEPAGE.com")+ 
                        "&name=" + encodeURIComponent(title) + 
                        "&caption=" + encodeURIComponent('Shared from MY_PAGE') + 
                        "&description=" + encodeURIComponent('DESCRIPTION') + 
                        "&picture=" + encodeURIComponent("http://www.THEPAGE.com" +im_url) +
                        "&redirect_uri=https://www.facebook.com";
            window.open(url);
        });

See More!

font

    
10.03.2015 / 01:05