The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Wed Dec 21, 2011 4:50 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Apr 12, 2010 3:25 am
Posts: 115
Hello,

I am trying to improve loading time of the website. As I test the loading speed through Page Speed (Chrome Browser) I get the suggestion to "Defer parsing of JavaScript."

As I researched how to implement the deferral this, I found that by changing the script link tag from:

<script src="/media/system/js/core.js" type="text/javascript"></script>
<script src="/media/system/js/mootools-core.js" type="text/javascript"></script>
<script src="/media/system/js/caption.js" type="text/javascript"></script>
<script src="/media/system/js/mootools-more.js" type="text/javascript"></script>

to:

<script src="/media/system/js/core.js" type="text/javascript" defer></script>
<script src="/media/system/js/mootools-core.js" type="text/javascript" defer></script>
<script src="/media/system/js/caption.js" type="text/javascript" defer></script>
<script src="/media/system/js/mootools-more.js" type="text/javascript" defer></script>

this warning would go away.

The files I am getting this warning for are:

239.7KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering.
root/media/system/js/mootools-more.js (155.8KiB)
root/media/system/js/mootools-core.js (79.1KiB)
root/media/system/js/core.js (3.6KiB)
root/media/system/js/caption.js (744B)

How can I make the change of this tags for these files?

Thank you

_________________
http://websonalized.com Small Business Web Design


Last edited by humvee on Mon May 14, 2012 10:51 am, edited 1 time in total.
Marked as resolved


Top
 Profile  
 
PostPosted: Thu Dec 22, 2011 7:59 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Dec 22, 2011 6:56 am
Posts: 12
Hi !
Defer has a very limited impact on page loading. You'd better to load javascript at the bottom of your pages when it is possible.
You should also concentrate your efforts on more paying solutions :-)


Top
 Profile  
 
PostPosted: Thu Dec 22, 2011 8:08 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Apr 12, 2010 3:25 am
Posts: 115
Thank you Ianac

Could you elaborate on

lanac wrote:
concentrate your efforts on more paying solutions :-)


Thank you,

_________________
http://websonalized.com Small Business Web Design


Top
 Profile  
 
PostPosted: Thu Dec 22, 2011 8:13 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Dec 22, 2011 6:56 am
Posts: 12
Maybe you can give me your website URL to see if there is some other areas of interest you must concentrate on to give a real boost on your website :)
Plus, defer can fail to load scripts in the right order on IE, so keeping mootools &co without defer is a good thing if you have plugins that depends on it.

_________________
http://www.wikeo.be Create a website quickly and easily


Top
 Profile  
 
PostPosted: Thu Dec 22, 2011 7:38 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Fri Jan 09, 2009 3:16 pm
Posts: 555
Location: Tampa
I would try and combine them

http://extensions.joomla.org/extensions ... ance/12088


Top
 Profile  
 
PostPosted: Wed May 09, 2012 8:32 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sun Apr 29, 2012 10:44 pm
Posts: 3
Location: Virginia, USA
The correct syntax is defer="defer"


Top
 Profile  
 
PostPosted: Wed May 09, 2012 8:38 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Apr 12, 2010 3:25 am
Posts: 115
Actually I ended up adding the following attribute to the script tag of certain files

async="async"

Example:

<script src="/media/system/js/caption.js" type="text/javascript" async="async"></script>
<script src="/media/system/js/mootools-more.js" type="text/javascript" async="async"></script>

This took care of the problem I had when I first made the post

_________________
http://websonalized.com Small Business Web Design


Top
 Profile  
 
PostPosted: Mon Aug 13, 2012 2:50 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Sep 23, 2007 9:34 pm
Posts: 29
Location: Punta Cana, Dominican Republic
IberoMedia wrote:
Actually I ended up adding the following attribute to the script tag of certain files

async="async"

Example:

<script src="/media/system/js/caption.js" type="text/javascript" async="async"></script>
<script src="/media/system/js/mootools-more.js" type="text/javascript" async="async"></script>

This took care of the problem I had when I first made the post


when we should use defer="defer" and when async="async"?

anybody knows what to add to script for google ads? (google ads stops working when adding async="async" and defer="defer")

I see that Google button +, is using po.async = true;
defer and async are boolean attributes. "The values "true" and "false" are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether."


Top
 Profile  
 
PostPosted: Sun Oct 14, 2012 2:08 am 
Joomla! Explorer
Joomla! Explorer

Joined: Thu Feb 17, 2011 6:13 am
Posts: 305
Alextampa wrote:


Yes, I would like to defer the parsing too. I am using JCH optimze yet the defer doesn't work for me. Says it in the source, but Gtmetrix didn't recognize. Anybody have other directions?


Top
 Profile  
 
PostPosted: Fri Dec 14, 2012 10:30 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Dec 14, 2012 10:25 am
Posts: 1
ok you found the solution but please tell us How can we make the change of this tags for our files... for example for

modules/mod_flyout/js/jquery.colorbox.js (14.2KiB)
media/system/js/modal.js (8.7KiB)

how i can change the script tag? where i must look at what file? i looked in index.php but nothing.. i looked in js files but only ansync:true found there.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 



Who is online

Users browsing this forum: readus, sander_v_bergen and 33 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group