Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to change the caption using the javascript Facebook api to post to wall

I am using Facebook javascript to publish/post to user wall. HEre is my code below. Everytime user post to wall they get a screen like below. The problem is I am getting "www.facebook.com" in the caption after the Title text "Pandora-whichstar are you". Any idea how to either remove this permanently or change this to something more convenient?

The image

enter image description here

The Code

/facebook: post to wall 
function publishWallPost() {
      var fbImg = $('.head .headerLeft p img')[0].src;
      var fbTxt = $('.head .headRight span.artistName').text();
      FB.ui({
          method: 'feed',
          name: 'Pandora - Which Star Are You',
          caption: 'Convenient caption text here?',
          description: 'I\'m ' + fbTxt + ' according to Pandora\'s Which Star Are You competition.\n Click on the title to find out which star you are!',
          link: 'https://www.facebook.com/pages/xxx/11111111111?sk=app_2222222222',
          picture: fbImg
        },
        function (response) {
          console.log('publishStory response: ', response);
        });
      return false;
}


window.fbAsyncInit = function () {
      FB.init({
        appId: '2222222222',
        status: true,
        cookie: true,
        xfbml: true
      });
};

(function () {
      var e = document.createElement('script');
      e.async = true;
      e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
      document.getElementById('fb-root').appendChild(e);
}());
like image 231
Hello Universe Avatar asked Nov 22 '25 01:11

Hello Universe


2 Answers

If Facebook is not letting you set the caption for a link on Facebook.com, what you can do instead is create a page that does a 301 redirect to the Facebook page you want to share and use that URL as the link parameter.

If a 301 redirect won't work, you can do a javascript redirect instead, but the same principle still applies.

like image 109
Fisch Avatar answered Nov 23 '25 14:11

Fisch


Do it like @Fisch told u. Build a site with an JS Redirect and use the OG Meta Tags.

https://developers.facebook.com/docs/opengraph/

like image 26
Hackbard Avatar answered Nov 23 '25 15:11

Hackbard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!