0

Why is this so hard?

I want to emulate the "like social plugin" on my website to my facebook PAGE (who has an app?) doing something like this:

HTML:

<a href="someurl">Like</a>

JS:

$.ajax('someurl', { data: JSON.stringify({whatever: isRequired})})
   .done(function(response) {
       //update UI
   });

I've already loaded the JS SDK, I just can't actually do anything with it because it's asking for an AppId, which I neither have nor want (unless there was a way to link an App to a page). I'm completely befuddled as to why this is such a ridiculously hard process. I've pored over all the API documents and am having problems making sense of it all.

Am I stuck using their blasé button, or is there a way I can make the calls to Facebook myself?

Jason
  • 51,583
  • 38
  • 133
  • 185
  • Why you do not want to have an app? You can just create a dummy app, and just generate and app-id then use it. You do not need to show your app to outside since you can set app as sandbox mode. – Teoman shipahi Mar 29 '13 at 22:04
  • Because I want the likes to go to my facebook page, not my app. I've already got a bunch of likes for my page. It would suck if I had to start all over with an app – Jason Mar 29 '13 at 22:04
  • Like will not go to your app, it will go to your Facebook Page URL. Which is a parameter for plug-in. – Teoman shipahi Mar 29 '13 at 22:06
  • no no. Just because you give your app id does not mean you're likes will go to the app. Its the way you are allowed to communicate with FB. – Brad Mar 29 '13 at 22:06
  • @Brad if that's the case, how do I post a "like" to my FB page using an app Id? (i actually do have an app id, i just didn't want likes going there) – Jason Mar 29 '13 at 22:09

1 Answers1

0

You don't need an appID for "like social plugin",

Load SDK

<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";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Like Button

<div class="fb-like" data-href="http://yourfacebookpageurlnotApp" data-send="false" data-width="450" data-show-faces="true"></div>

Like Box

<div class="fb-like-box" data-href="http://yourfacebookpageurlnotApp" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div>

DEMO for http://www.facebook.com/stackoverflowpage

More Info on developer.facebook.com

Okan Kocyigit
  • 13,203
  • 18
  • 70
  • 129
  • thanks for the answer, but this is just how to add a pre-made like button. i'm looking for how to fire the mechanism myself so i can create my own button. – Jason Mar 30 '13 at 01:14
  • you can't like a facebook page or website via API (with your custom like button). that's impossible because of security issues. here are some questions asked before about this, http://stackoverflow.com/questions/4379092/is-it-possible-to-like-a-facebook-page-via-the-api http://stackoverflow.com/questions/3061054/like-a-page-using-facebook-graph-api – Okan Kocyigit Mar 30 '13 at 01:26