Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FBConnect: Why is it showing on some pages and not others?

In the top right hand corner, it shows on this page:

http://www.thegreekmerchant.com/product/fokofpolisiekar/band-logo

But not on this one

http://www.thegreekmerchant.com/

Any idea why? I'm using Drupal 6 with the FBConnect module.

like image 942
coderama Avatar asked May 12 '11 19:05

coderama


1 Answers

In fact, the problem is that the pages use different scripts to load the FBConnect module.

On http://www.thegreekmerchant.com/:

<div id="fb-root"></div>
  <script type="text/javascript">
    window.fbAsyncInit = function() {
      FB.init({
        appId  : '146943825373452',
        status : true, // check login status
        cookie : true, // enable cookies to allow the server to access the session
        xfbml  : true,
        logging: '0'
      });

      jQuery(document).trigger('fb:init');
    };

    (function() {
      var e = document.createElement('script');
      e.src = document.location.protocol + '//connect.facebook.net//all.js';
      e.async = true;
      document.getElementById('fb-root').appendChild(e);
    }());
  </script>

On http://www.thegreekmerchant.com/product/fokofpolisiekar/band-logo there are two scripts, the previous one and the following one:

<div id="fb-root"></div><script type="text/javascript">
 window.fbAsyncInit = function() {
   FB.init({
     appId: "146943825373452",
     status: true, 
     cookie: true,
     xfbml: true
   });

   FB.Event.subscribe("edge.create", function(href, widget) {
      _gaq.push(["_trackEvent", "Facebook like", "Drupal", href]);
   });


 };
 (function() {
   var e = document.createElement('script'); 
   e.async = true;
   e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
   document.getElementById('fb-root').appendChild(e);
 }());
</script>

I've replaced the first script with the second one and http://www.thegreekmerchant.com/ now works (of course not the sharp version, but on my sandbox server). You only need the second script on http://www.thegreekmerchant.com/product/fokofpolisiekar/band-logo.

like image 162
AndersTornkvist Avatar answered Oct 23 '22 07:10

AndersTornkvist