Jump to content

UseJS

From Meta, a Wikimedia project coordination wiki

UseJS

UseJS imports JavaScript for the current page when the URL contains a parameter like &usejs=MediaWiki:Tabs.js. It only accepts scripts in the protected MediaWiki: namespace, so these are equivalent: &usejs=MediaWiki:Tabs.js, &usejs=tabs.js, &usejs=tabs.

Installation

[edit]
  1. Copy the following code to your global.js page (for all wikis) or your common.js page (for Meta only).
    /**
     * Imports JaveScript for the current page when the URL contains a &usejs parameter.
     * @see https://meta.wikimedia.org/wiki/UseJS
     * @update-token [[File:Pathoschild/usejs.js]]
     */
    mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.usejs.js');
    
  2. Refresh your browser to reload the JavaScript. (In Chrome or Firefox, press [CTRL] and [R] at the same time.)

See also

[edit]