× Joomla Facebook Connect support forum

Topic-icon Combine JS; on DOM Ready?

Active Subscriptions:

None
15 years 1 month ago #522 by wriggler
Hi,

I've got the FB Connect component working fine, thanks to your great tech support.

One question: FB Connect loads a lot of JS, which means a lot of HTTP requests and noticeably slower page load times. Is there any way to bunch together all of the FB Javascript files before loading it in the browser? Failing that, is there any way you can suggest that I could modify the component code to make FB Connect load only on DOMReady/onLoad? This would at least allow the page to show properly before Facebook starts loading its libraries.

Thanks,

Matt
The topic has been locked.
Active Subscriptions:

None
15 years 4 weeks ago #553 by wriggler
Replied by wriggler on topic Combine JS; on DOM Ready?
Bump...

I'd really like your opinion on this...
The topic has been locked.
Support Specialist
15 years 3 weeks ago #568 by alzander
Replied by alzander on topic Combine JS; on DOM Ready?
So we already do include some things using Mootool's DomReady function. The only javascript that's included from FB is below. I don't think theirs others, but lemme know if I'm missing something.
<script type="text/javascript" src="static.ak.connect.facebook.com/js/api_li...FeatureLoader.js.php">

If you can pinpoint a file that you think we're loading that's noticeably slowing the site down, don't hesitate to point it out. Not sure where you seem to be getting the slowdown from.
The topic has been locked.
Active Subscriptions:

None
15 years 3 weeks ago #576 by wriggler
Replied by wriggler on topic Combine JS; on DOM Ready?
Hi,

There are about 8 external JS files, and a number of inline statements, that seem to be inserted by FB Connect. It's not that the files are particularly big, but they increase the number of HTTP requests quite dramatically, which is a pain for site speed optimization. So I was wondering if they could be bunched together into one file before download, somehow. I'd also like to put the inline JS into an external file, and to be able to put the FB CSS in the doc head, instead of it being in the body.

I've attached a screenshot from FireBug, so you can see what I mean.

Thanks,

Matt
The topic has been locked.
Support Specialist
15 years 3 weeks ago #599 by alzander
Replied by alzander on topic Combine JS; on DOM Ready?
We will investigate further, but can't say much more about this now. We really only include 1 JS file from Facebook. They're including the remaining 8 files, and they could potentially one day include 800 if they wanted too. Obviously, don't think this will be the case :) I'll look into adding the 1 file to a DomReady call from mootools, but it may not work there since some of the functions (I believe) need to be run as they're encountered on the page due to the namespace translations that facebook requires (extensions to the html spec with lines like <fb:login-button> </fb:login-button> which actually 'creates' more code on your page).

The inline JS isn't causing any extra http requests, but it's possible we could condense it some more. With the login module, I know it is, but there could be better ways to do it to make sure any JFBConnect code from a page is tidily put in the same spot.
The topic has been locked.