最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Need to change the caption using the javascript Facebook api to post to wall - Stack Overflow

programmeradmin4浏览0评论

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" 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

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 petition.\n Click on the title to find out which star you are!',
          link: '',
          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/en_US/all.js';
      document.getElementById('fb-root').appendChild(e);
}());

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." 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

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 petition.\n Click on the title to find out which star you are!',
          link: 'https://www.facebook./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/en_US/all.js';
      document.getElementById('fb-root').appendChild(e);
}());
Share Improve this question edited Mar 14, 2014 at 4:44 Sahil Mittal 20.8k12 gold badges67 silver badges91 bronze badges asked Nov 6, 2013 at 0:38 Hello UniverseHello Universe 3,3127 gold badges57 silver badges91 bronze badges 4
  • Are you sharing the facebook page tab app? – Sahil Mittal Commented Nov 10, 2013 at 17:08
  • yeep I am . I just want the caption text to say something else... better yet not to have the caption text at all – Hello Universe Commented Nov 11, 2013 at 4:13
  • this is where I m having the issue . A js redirect is not feasible for this... on.fb.me/1hCfgOX – Hello Universe Commented Nov 12, 2013 at 10:29
  • @Himu why not ? You can built a simple html page and drop it to dropbox. It's that simple? Is there any other issues? – MD. Sahib Bin Mahboob Commented Nov 16, 2013 at 10:19
Add a ment  | 

6 Answers 6

Reset to default 2

If Facebook is not letting you set the caption for a link on Facebook., 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.

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

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

If u give caption or don't give caption, Facebook scraps URL.
By mandate,Facebook Domains URLs are not scraped.Link 1
For URLs that cannot be scrapped mostly the caption is taken from Domain part.[For this is Facebook leave matter in users hands whether to go ahead with click or not.]

As Sahil, I am to afraid that "caption edit" is not possible.

you can't give the Facebook page link on web dialogue. you need to do what @Fisch and @Hackbard are telling you to do.

you need to give the link of some webpage that has following meta tags on it:

<meta property="fb:app_id" content="123456789(your Facebook app id)" />
<meta property="og:title" content="X  Y  Z"/>
<meta property="og:type" content="game" /> (this depends upon your Facebook settings)
<meta property="og:url" content="www.yourWebpageLink./toPullOffDetails" />
<meta property="og:site_name" content="YOUR SITE NAME"/>
<meta property="og:image" content="http://the_image_you_want_to_show_on_that_dialogue"/>
<meta property="og:description" content="This is X Y Z, the best example on the planet" /> 

Build a page with javascript redirect window.location('url') to your app page as others mentioned but you should not have to do something else. All of your configs look okay.

Disclaimer: Do not use server side redirect as facebook will find out the URL you need to use javascript redirect as scrappers do not execute javascript.

While sharing a facebook link, facebook gives the relevant caption (sometimes description also) by itself.

If you try some link other than facebook, and give caption parameter you can see your caption in the feed. So, am afraid that you cannot edit the caption in your case.

发布评论

评论列表(0)

  1. 暂无评论