Take the 2-minute tour ×

maexculture.tumblr.com is my site.

Just installed the facebook button and first of all, it asks to confirm the likes, then after confirming and pressing "Like" it switches to count it and then goes back to zero. The "send" function works. But the Like function is not - nothing shows up on facebook and the like is not counted.

This is what I have at the top of my page:


And the specific buttons:

<div class="facebook-button">
    <div class="fb-like" data-href="{Permalink}" data-send="true"

I also have this code in there near the head tags

  if (d.getElementById(id)) return;
  js = d.createElement(s);
  js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=271140516272162";
  fjs.parentNode.insertBefore(js, fjs);

Let me know if you need any more information.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Couple issues:

If your code is "near the head tags" there's a good possibility that the DOM won't have been fully populated when it executes, and therefore that it will miss detecting some elements. Any script that accesses or manipulates existing DOM elements needs to come after any HTML that creates those elements (e.g. right before </body>).

fjs = d.getElementsByTagName(s)[0] is really fragile, since it depends on one particular script element being the very first one in your document. Put an ID on that script and then look it up with getElementByID()

To answer your comment, I mean something like (in HTML)

<script id="fjs" type="text/javascript" src="..." </script>

(in processing script)


In other words, instead of counting on a particular <script> element being the first one in your document, you stick an id label on it so you can find it no matter where it is.

share|improve this answer
Hey ebohlman, I'm a little confused on the second part of your response. What do you mean by putting an ID on the script and looking it up? -Sorry, bit of a newcomer to backend stuff. Thanks for the help though! –  Dan Harris Sep 11 '12 at 17:51
Editing answer to clarify, so I can show code formatted as such. –  ebohlman Sep 12 '12 at 11:58
Thanks! Got it working! –  Dan Harris Sep 13 '12 at 21:23

Your Answer


