The importance to include script on bottom of the page

591 views
Skip to first unread message

Viktor Iwan

unread,
Aug 12, 2012, 6:32:34 AM8/12/12
to joomla-de...@googlegroups.com
Hello all,
i would like to ask your opinion on the importance for joomla to have the capability to include script in bottom of the page. At the moment i'm using a custom module and for general template i'm using template. But it would be awesome if there will be capability to include script in bottom, something like
<jdoc:include type="bottom" /> in bottom of template file

and when we build a component, we simply add:
$doc->addScriptDeclaration( $script,'text/javascript','bottom' );

what do you think ?

Imanol Pérez Iriarte

unread,
Aug 12, 2012, 6:41:25 AM8/12/12
to joomla-de...@googlegroups.com
Yeah, It'll be a nice feature. In fact all the twitter bootstrap template is designed that way.

2012/8/12 Viktor Iwan <vic...@doxadigital.com>

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/Bz054aGWvHYJ.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

Nick Savov

unread,
Aug 12, 2012, 11:59:18 AM8/12/12
to joomla-de...@googlegroups.com
Hi Victor,

If I understand you correctly, you can create a plugin for that. Or you
can use an available plugin from the JED. E.g.:
http://extensions.joomla.org/extensions/core-enhancements/performance/scripts-optimization/12559

Kind regards,
Nick

Beat

unread,
Aug 13, 2012, 5:53:27 AM8/13/12
to joomla-de...@googlegroups.com
FYI: Putting scripts at bottom of pages is obsolete: Javascript has asynchronous and defered loading attributes now for the script files tags leading to same final effect but without an additional page redraw like with scripts at end.

Best Regards,
Beat

Rouven Weßling

unread,
Aug 13, 2012, 7:30:21 AM8/13/12
to joomla-de...@googlegroups.com
Thanks Beat, taking the words out of my mouth.

As an additional note JDocument has supported these attributes at least since Joomla 1.7 (http://api.joomla.org/Joomla-Platform/Document/JDocument.html#addScript). JHtml doesn't yet support it thou.

Best regards
Rouven

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/_XaYt6uWfxoJ.

Viktor Iwan

unread,
Aug 14, 2012, 1:59:25 AM8/14/12
to joomla-de...@googlegroups.com
Sorry, i'm not to techie for this..
But i see some site put the javascript at the bottom, even twitter bootstrap still doing this,

sorry, didn't mean to underestimate but where can i have a reference for this statement ?

Thanks


Pada Senin, 13 Agustus 2012 18:30:21 UTC+7, Rouven Weßling menulis:
Thanks Beat, taking the words out of my mouth.

As an additional note JDocument has supported these attributes at least since Joomla 1.7 (http://api.joomla.org/Joomla-Platform/Document/JDocument.html#addScript). JHtml doesn't yet support it thou.

Best regards
Rouven
On 13.08.2012, at 11:53, Beat <bea...@gmail.com> wrote:

FYI: Putting scripts at bottom of pages is obsolete: Javascript has asynchronous and defered loading attributes now for the script files tags leading to same final effect but without an additional page redraw like with scripts at end.

Best Regards,
Beat

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/_XaYt6uWfxoJ.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-general+unsub...@googlegroups.com.

Rouven Weßling

unread,
Aug 14, 2012, 6:44:58 AM8/14/12
to joomla-de...@googlegroups.com
What do you have in mind? The spec for the async and defer attributes can be found in the latest working draft of HTML5:


Note that async is a new HTML5 feature while defer is HTML4.

Best regards
Rouven

To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/9QybbaBvJzoJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.

piotr_cz

unread,
Aug 14, 2012, 11:36:15 AM8/14/12
to Joomla! General Development
Moving scripts to bottom is fine when you have total control over the
code (probably using static html or in-house publishing platform).

This may end up pretty bad in a open CMS, when some extension adds an
inline script that's utilizing a javascript framework or adds scripts
using own methods (templates do so).

Imagine a carousel module adding inline scripts in it's html output.
It's using Mootools/ jQuery but that one isn't loaded yet (as it's at
the bottom of html), so script throws an error and stops execution of
all remaining inline JS code.
Cannot use domready events because these were not attached to the
window object by Javascript framework.

Safe thing for a CMS is to add <script> in <head>.
Reply all
Reply to author
Forward
0 new messages