Allow `tel:` protocol hyperlinks in MediaWiki
Published:
In MediaWiki you can already make email hyperlinks ([mailto:someone@example.com Mail someone]
), but telephone number hyperlinks aren't allowed for some reason by default ([tel:0123456789 Call someone]
). Turns out to be an easy fix though.
Simply add the following to LocalSettings.php.
array_push($wgUrlProtocols, 'tel:');
Make it prettier
The links will get same icon as external links, which is a bit annoying, but that can be fixed as well. Find the main CSS file for your theme, in our case /skins/monobook/main.css
, and look for a section which looks like the following.
#bodyContent a.external[href^="mailto:"],
.link-mailto {
background: url("mail_icon.gif") no-repeat scroll right center transparent;
padding: 0 18px;
}
Simply make a copy of that section and replace all instances of 'mailto' with 'tel' and set the URL to the icon you want. The icon should of course be uploaded to the same location as the CSS for that to work 🙂