× Joomla Facebook Connect support forum

Topic-icon Howto suppress generating this Javascript code?

Active Subscriptions:

None
10 years 9 months ago #34742 by guero
Hi!

We're using JFBConnect and each page of our site no matter if an article, a menu of what ever kind of Joomla component has the following code embedded. Is there any chance to avoid that JFB software inserts this code fragment into every page? We do have a special Joomla menu page where I do not want that this code gets embedded. I do not mind to patch if you can tell me where this code snippet gets generated and is finally inserted. Within this php file it should be possible to check the url of this given page and ignore insertion of this code?!
<body><div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: 'MY_APP_ID', status: false, cookie: true, xfbml: true, oauth: true, channelUrl: 'http://mysite.com/components/com_jfbconnect/assets/jfbcchannel.php'});
FB.Event.subscribe('comment.create', jfbc.social.comment.create);
FB.Event.subscribe('edge.create', jfbc.social.like.create);
};
(function(d){
     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_GB/all.js";
     d.getElementsByTagName('head')[0].appendChild(js);
   }(document));
</script>

Thanks for your support
Frank
The topic has been locked.
Support Specialist
10 years 9 months ago #34749 by alzander
Frank,
That code is in the /plugins/system/jfbcsystem.php file. You can remove it if you really know what you're doing, however, I wouldn't recommend it. That code is required for any of the following features:
* Facebook Login
* Automatic login of users
* Any social widgets (Like, Comment, Fan module, etc)
* Facebook Requests/Invites
* Page Tab / Canvas support

Basically, if you're using any of JFBConnect's features on the page you want to remove it from, those features will no longer work. Additionally, the Facebook Javascript file is something that gets cached in the user's browser. While it is executed on each page (which may take 50milli-seconds or so), it should not be re-downloaded on each page, which is where most of the delay would be introduced.

I hope that helps,
Alex
The topic has been locked.