Jason Cobb
Jason Cobb

Reputation: 1

Adding "via MyApp" text to Facebook Social Plugins

With Facebook API I can create a simple "Post to my Wall" app, which adds a "via MyApp" text to every post that is published by user.

However, if a user adds a comment using Comments Box their post will show on their Wall without the "via MyApp" text. The same situation takes place when a user clicks on the Like Button and leaves a comment to their like.

What can be done to include the "via MyApp" text?

My code:

<div id="fb-root"></div>
<script>(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/all.js#xfbml=1&appId=MYAPPID";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<fb:comments href="http://example.com" num_posts="2" width="470"></fb:comments>

Upvotes: 0

Views: 202

Answers (1)

Inam Abbas
Inam Abbas

Reputation: 1480

In your comment box script like the one below just replace appId=3453534536334 with your application ID of MyApp

<div id="fb-root"></div>
<script>(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/all.js#xfbml=1&appId=3453534536334";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Upvotes: 1

Related Questions