Forum is closed

Combine JS; on DOM Ready?

Combine JS; on DOM Ready?

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

wriggler
useravatar
Offline
7 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Combine JS; on DOM Ready?

Bump...

I'd really like your opinion on this...

wriggler
useravatar
Offline
7 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: 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="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"></script>

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.

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
23902 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: 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

wriggler
useravatar
Offline
7 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: 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 current/smile  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.

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
23902 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.
There are 0 guests also viewing this topic
There are 0 users also viewing this topic

Board Info

Board Stats
 
Total Topics:
11548
Total Polls:
0
Total Posts:
48577
Posts today:
11
User Info
 
Total Users:
47563
Newest User:
dhotañ
Members Online:
0
Guests Online:
1696

Online: 
There are no members online
Social Stream
Refer and Earn

Like our extensions? You're not alone! That's why they're used on tens of thousands of websites. Now you can earn 20% of any sale you refer to SourceCoast.com.

We provide excellent documentation, well laid out sales pages and great support. All you need to do is spread the word and we'll take care of the rest.

Learn About Our Affiliate Program