dev

ExternalLinkWarning shows a warning dialog when an external link is clicked allowing the user to back out of following the link.

Installation

Configuration

Dialog text

For site-wide use the text used in the dialog can be overridden by creating MediaWiki:Custom-ExternalLinkWarning which should contain a single line with the following format.

title|message|continue|cancel

All of the above are optional. For instance to just change the continue button to say OK use.

||OK

The text does not have to be in English.

Pages

You can control what pages ExternalLinkWarning will affect by defining one or both of following variables:

Variable Type Purpose
ExternalLinkWarningNamespaces Array of strings If this variable is defined the script with only be active on pages in the supplied canonical namespaces.
ExternalLinkWarningPageRegex Regular expression If this variable is defined the script will only be active on pages whose path matches the supplied regular expression.

Examples

To limit the script to forums, and message walls:

window.ExternalLinkWarningNamespaces = ['Forum', 'Thread', 'Message_Wall'];

To limit the script to articles that start with the prefix "Decks/":

window.ExternalLinkWarningPageRegex = /^\/wiki\/Decks\//;

If using the script personally these should be added before the importArticles. If using the script globally then these definitions should be placed in the site global JS file.

If both variables are defined the script will only be active on pages that meet both criteria.

Demo

Click here to view the warning.

Dependencies

See also

Text above can be found here (edit)