0

I am trying to add facebook like to my mediawiki skin. I have the code:

<html xmlns:fb="http://ogp.me/ns/fb#">
<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_GB/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));
    </script>

<fb:like href=' . urlencode($wgTitle->getFullURL()) . ' send="true" width="450"       show_faces="false"></fb:like>

On the pages where facebook like shows up I get the error FB.Type.createClass2 is not a function in firebugs and on other pages it simply doesn't show up and there is no error. How do I get it to show up on every page?

LTech
  • 1,677
  • 5
  • 29
  • 48

1 Answers1

1

Embed the Like button like this:

<div class="fb-like" data-href=" . urlencode($wgTitle->getFullURL()) . " data-send="true" data-width="450" data-show-faces="false"></div>

Yan Berk
  • 14,328
  • 9
  • 55
  • 52
  • Seems to be working perfectly now. Thanks so much. Would never have guessed that. Why did adding the
    make a difference?
    – LTech May 09 '12 at 08:07
  • It doesn't seem to be working with google chrome. I've cleared my cache and still random pages don't show facebook like. Works well in firefox and IE – LTech May 09 '12 at 08:12
  • Unsafe JavaScript attempt to access frame with URL http://xxx.com/wiki/ from frame with URL http://www.facebook.com/extern/login_status.php?api_key=xxx=2&channel=xxx – LTech May 09 '12 at 09:16
  • read here: http://stackoverflow.com/questions/8013008/facebook-authentication-unsafe-javascript-attempt-to-access-frame-with-url – Yan Berk May 09 '12 at 09:30
  • is this a google chrome issue that I can't solve or a facebook like issue? – LTech May 10 '12 at 20:04
  • This is a non fatal error, some other error is preventing it from working. – Yan Berk May 11 '12 at 09:19
  • how do I know what that error is. http://thepetwiki.com/wiki/Goldfish_-_A_simple_guide. is a webpage in chrome where facebook like doesn't work. If you could work out why that would be amazing. (google+ seems to be having issues as well, only some of the icon is showing) – LTech May 12 '12 at 20:21