Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How do I move some JS to the bottom of the page
 
firefly
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-06-05
 

Hi,
I have enabled deflate module on Apache and it has given me vast improvement in page load times.

However, it does not work under some conditions, such as,old browers or browers that do not support gzip or if you are behind some firewalls.

So i also have to cater for these people as well. My biggest concern is the time it takes to load the first page (20seconds) The best solution I have so far learnt is to move unneeded javascripts to the bottom of the page. this will not improve overall page speed, but at least the users can see the page/most of the page while non-critical javascript is still loading.

Q1: how do I move javascript to the bottom of pages
Q2: what are the critical javascripts in Magento that need to be loaded in the header?

Thanks in advance

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

Hi,

I’d like to know this too, this would be very useful!

Many thanks,
Lisa

 
Magento Community Magento Community
Magento Community
Magento Community
 
toman01
Sr. Member
 
Total Posts:  92
Joined:  2008-03-07
 

I asked this question several months ago but unfortunately did not receive a response. I believe the Magento Team knows what it’s doing and am sure there is a reason that all the javascript is at the top and not called last.

If you want the first page to load fast then I suggest you create a template just for the homepage that doesn’t call the default “head” but instead a custom one without any javascript or only the scripts that are required.

 
Magento Community Magento Community
Magento Community
Magento Community
 
firefly
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-06-05
 

Thanks a lot. I will try your suggestion.

I still like to know what are the critical files that need to be loaded in the header. IE recognises a differ element that I’d like to use when i know what files to load in the header and which ones i can call later on.

BTW, I am sure the magento team has put all the js together is to reduce the number of calls and also so it gets gziped together. Both performance improvement tricks.

Lisa, I found another trick. I minimised my js files, by removing white spaces etc. gained about 30K. Yahoo has a minimise script that does this. There are others but they were way too complicated for me. Can do the same with CSS files but I didnt see much of a size difference.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

Thanks a lot firefly, will try that!

Lisa

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top