Question

This is my share button:

<div style="float:right; margin-right: 10px;" class="fb-share-button" data-href="<?php the_permalink();?>" data-width="50" data-type="button_count"></div>

I use Wordpress.

I get this error:

POST https://www.facebook.com/ajax/sharer/submit_page/ 500 (Internal Server Error) jZP0HIKXhfW.js:62

I have included the Facebook SDK script after opening tag

<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/lt_LT/sdk.js#xfbml=1&version=v2.0";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>

What can cause this error?

Was it helpful?

Solution

I have the same issue on one of my websites. Didn't find a solution to the problem yet, but in my case 2 things happened before this bug appeared (the FB sharer button worked fine before):

  1. Introduced og: tags in the head section of my page (FB debugger shows all of them are OK, the page looks fine in the debugger tool)

  2. Introduced the share button for twitter, this works fine

update: found the problem finally: it looks like you can only share things on FB if you have a Facebook AppID, so you need to create one on https://developers.facebook.com/ After you create the Application, get the embed code again and the AppId will be automatically included into the code snippet they generate for you. Your code will look something like this:

<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/sdk.js#xfbml=1&appId=3#########4&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

OTHER TIPS

This seems to be a bug on Facebook's behalf - as their Like button plugin doesn't require an appId and their Share Button code-generator doesn't include any references to it being required.

That said I've found a workaround that doesn't require signup/AppID-registration.

What I did was simply to copy any existing AppID and stuff it at the end of the sdk.js URL, Like so:

<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/sdk.js#xfbml=1&version=v2.0&appId=XXX";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

(The one I used in place of the "XXX" above, was an App ID from one of Facebook's own sites.)

There seems to be no validation being performed, which again leads me to believe this is a temporary blunder made by Facebook.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top