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

  • From: Sam Wilson <sam@xxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 24 May 2013 19:16:30 +0800

On 05/24/2013 06:25 PM, Mark Prins wrote:
It may. As you pointed out it's largely a template thing, which is small change, however many plugins use an action plugin to append script elements to the head element of a page, ie. they listen for the TPL_METAHEADER_OUTPUT event as described in https://www.dokuwiki.org/devel:action_plugins#sample_action_plugin_-_add_always_a_javascript_file Currently I don't think (I may well be wrong here) that there is any event that you can attach to which signals the (before the) end of the body element rendering and allows easy insertion of script elements as TPL_METAHEADER_OUTPUT does, for fixing the plugins I think this would be required, and could be a big change. As a side effect having javascript modify the page after loading may cause reflows of the page content, this could probably also be fixed in the plugins though.

What are the reasons for inserting script elements at the end? 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).

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.


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.


DokuWiki mailing list - more info at

Other related posts: