Help:External link icons

From Safer nicotine wiki
Jump to navigation Jump to search

External links usually display an icon at the end of the link. CSS is used to check for certain filename extensions or URI schemes and apply an icon specific to that file type, based on the selected skin.

This page contains example URLs to demonstrate the link icons. The displayed icon only depends on the URL itself. It is not checked whether a file of that type is actually at the link. The examples here do not link to real files.


MediaWiki software detects URI schemes and/or filename extensions to create a link; thus links without an URI will not have an external link applied. MediaWiki does not attempt to detect any part of the URL to create a link, such as www, which many websites do not use in the URL.

The standard Wikipedia skin, Vector, shows only PDF icons, as does Cologne Blue. Modern, MonoBook and Timeless show a full set of filename extensions icons and some URI scheme icons; Minerva (mobile) shows none. Icons are defined in the CSS for each skin except for the PDF icon, which is displayed if "pdf" is anywhere in the filename extension.[lower-alpha 1]

Filename extension icons are displayed only if the extension matches the text. Filename extension icons have precedence over URI scheme icons. Internet Explorer may show an empty space or misplaced icon if the page is rendered with a line wrap inside the link text. Link icons do not adhere to accessibility standards, since alt text cannot be added.


Use these links to view this page with a different skin:
Type File extension Sample link
Portable Document Format .pdf .PDF, .pdf# .PDF# .pdf? .PDF?
Audio Video Interleave .avi .AVI
MPEG-1 .mpg .MPG .mpeg .MPEG
Ogg .ogm .OGM
MIDI .MID .midi .MID
MP3 .MP3
Ogg Vorbis .OGG
Waveform Audio File Format .WAV*
Windows Media Audio .wma .WMA
Type URI scheme Sample link
Internet Relay Chat irc:// ircs:// irc://
File Transfer Protocol ftp://
Network News Transfer Protocol news:
mailto mailto:
HTTP Secure https://
Apache Subversion svn:// svn://
Bitcoin bitcoin:// bitcoin://
FTPS ftps:// ftps://
Geo URI geo: geo:37.786971,-122.399677
Git git:// git://
Gopher gopher:// gopher://
Hypertext Transfer Protocol http://
Magnet URI scheme magnet:// magnet://
Multimedia Messaging Service mms:// mms://
NASA World Wind worldwind:// worldwind://
Network News Transfer Protocol nntp:// nntp://
Secure Shell ssh:// ssh://
Secure Session Initiation Protocol sips:// sips://
Session Initiation Protocol sip:// sip://
Short Message Service sms:// sms://
SSH File Transfer Protocol sftp:// s
Telephone tel:// tel://
Telnet telnet:// telnet://
Uniform resource name urn: urn:isbn:0451450523
XMPP xmpp:// xmpp://

Hiding link icons

A link icon can be hidden with the plainlinks class or {{Plainlink}}, but this is not advisable.

<span class="plainlinks"></span>

Custom link icons

Custom icons can be added by editing Special:MyPage/skin.css (current skin only) or Special:MyPage/common.css (all skins). For example, to add an icon for Excel files:

#content a[href$=".xls"].external,
#content a[href$=".XLS"].external,
#content a[href$=".xlsx"].external,
#content a[href$=".XLSX"].external {
    background: url("") center right no-repeat; padding-right: 18px;

When successfully updated, this link will show an Excel icon:

The markup detects file extensions .xls or .xlsx with both upper and lower case. The image must be 16 pixels wide. The image link must be from To get this link, go to the file page and click on the image to open it without the file description, then copy the URL.

To remove a default icon, simply add the CSS with no URL. For example, to remove the padlock icon when viewing secure links:

#content a[href ^="https://"].external {
    background: center right no-repeat; 
    padding-right: 18px;

To remove all the default icons, use this CSS:

#content a.external {
    background: none !important;
    padding: 0 !important;


See also


  1. ^ The default PDF icon is a generic document icon, but is changed to through Common.css.