1==== JavaScript ====
2
3DokuWiki makes uses of [[wp>JavaScript]] to enhance the user experience. Like for [[doku>css|stylesheets]] all JavaScript files are delivered through a single dispatcher to minimize HTTP requests, for caching and [[doku>config:compress|compression]].
4
5This page gives you an overview how JavaScript is loaded from DokuWiki core, [[doku>plugins]] and [[doku>templates]]. It also gives some info about event handling and coding style when writing JavaScript for use in DokuWiki.
6
7=== JavaScript loading ===
8
9All JavaScript is collected and delivered by [[xref>lib/exe/js.php]]. This file will concatenate all found files, whitespace compress (if
10[[doku>config:compress]] is enabled) and cache the result. It also instructs browsers to cache the file, so when you are developing new JavaScript, be sure to refresh your browser cache (hitting Shift-F5, Shift+CTRL+R or similar) whenever your script was updated.
11
12DokuWiki will load JavaScript from the following places:
13
14  * autogenerated JavaScript (language strings, config settings, [[doku>toolbar]])
15  * lib/scripts/*.js
16  * lib/plugins/*/script.js
17  * lib/tpl/<currenttemplate>/script.js
18  * conf/userscript.js
19
20As you can see you can provide JavaScript with your [[doku>templates]] and [[doku>plugins]] (through a ''script.js'' file) and can define your own scripts in ''conf/userscript.js''.
21
22=== See also ===
23  * [[doku>devel:javascript]]
24