Manual:Interface/JavaScript

MediaWiki:Common.js contains JavaScript that will be loaded for all users. This file is loaded for all users, but there are similar files affecting only users of specific skins (see below); although only Monobook.js is listed on Special:Allmessages, the other skin-specific scripts will work nonetheless.

if $wgAllowUserJs is set to true, users can customize the interface for themselves only by creating user subpages with lowercase titles (see below).

Global scripts

 * MediaWiki:Common.js (all skins - introduced in MW v1.9)
 * MediaWiki:Cologneblue.js (Cologne Blue)
 * MediaWiki:Monobook.js (MonoBook, default skin)
 * MediaWiki:Myskin.js (MySkin)
 * MediaWiki:Nostalgia.js (Nostalgia)
 * MediaWiki:Standard.js (Classic)
 * MediaWiki:Vector.js (Vector)
 * Special:Gadgets

Personal scripts

 * User:Example user/cologneblue.js as special:MyPage/cologneblue.js
 * User:Example user/monobook.js as special:MyPage/monobook.js
 * User:Example user/myskin.js as special:MyPage/myskin.js
 * User:Example user/nostalgia.js as special:MyPage/nostalgia.js
 * User:Example user/standard.js as special:MyPage/standard.js
 * User:Example user/vector.js as special:MyPage/vector.js

Some scripts for those pages

 * Importing from mediawiki.org - There are some few scripts such as edit-top-section & live-clock.
 * Extension:Gadgets/Scripts - if installed it permits users to easily pick-up into submitted scripts through users' preferences.

Global variables
For the benefit of easier Javascript programming, the MediaWiki software inserts a number of global Javascript variables on each page served.

The following variables are available on all pages:

Some additional variables are present only depending on whether certain user interface features are enabled or not, either globally or by a user in Special&rarr;Preferences.

One additional variable is available on the upload page:

Additionally, MediaWiki extensions can since version 1.14 add their own global variables through the MakeGlobalVariablesScript hook.