[dokuwiki] Re: Performance: scripts at the bottom?

  • From: Mark Prins <mc.prins@xxxxxxxxx>
  • To: dokuwiki <dokuwiki@xxxxxxxxxxxxx>
  • Date: Fri, 24 May 2013 14:27:05 +0200

2013/5/24 Sam Wilson <sam@xxxxxxxxxxxxxxx>:
> What are the reasons for inserting script elements at the end?

the reason for loading scripts after the main part of the page is
performance; browsers handle script elements in a blocking I/O mode
thereby holding up other things such as layout and download of other

> I generally
> just rely on the standard DW script minifying/combining process, and the
> only bits that get inserted in the page head are variable definitions (for
> passing values to the script, as is done with e.g. the JSINFO array... hmm,
> actually, come to think if it: is there some way to add to that; I've never
> looked).

no there are more than one script tags in the page header, the big one
holding all the compressed script is almost half a megabyte (this
depends on your config ofcourse) which about 10x the size of a typical
page.. waiting until this is dowloaded and parsed by the browser is
bad user experience.
Ideally it should be loaded as the last.
Also some plugins have big script libraries that are only loaded when
required (instead of on each pageload), but as I said before seems to
be no event telling us about the body almost having been renderered

> What I mean is, nothing I've had to insert into head has relied on the prior
> inclusion of anything (jQuery or other scripts), so the main script
> inclusion could easily be moved to the bottom without worry.  I think.

not unless a plugin has dependencies on dokuwiki's functions and/or
libraries such as jquery

> :-)
> Oh, the other thing that occured to me is that the delay in rendering might
> be good, because it stops people interacting with the page before all the JS
> behaviour is added.

people waiting for a webpage to render is never good, even split
seconds count...

This message is just a reflection of what I thought at the time of
sending. The message may contain information that is not intended for
you or that you don't understand.
DokuWiki mailing list - more info at

Other related posts: