How to set external links in MediaWiki to open in new browser tab windows

On the pages of your MediaWiki site can be placed links to either other pages on the same site or to other sites. By default, all the links open in the same browser window. If you want the links to external sites to open in new browser tabs, you can accomplish this with a simple modification to the LocalSettings.php file of your MediaWiki. On a new line at the end of the file add the following line:

$wgExternalLinkTarget = '_blank';

After you save the change all links on your MediaWiki site to external sites will open in new browser windows. The internal links (i.e. links to pages on the same site) will not be affected and they will open in the same window. If you want to reverse the action so that external links are again opened in the same window, either simply delete the line or place the symbol # in front of it (in this way later if you need to enable it again you can just delete that symbol).

The LocalSettings.php file that you have to edit is in the root MediaWiki folder on your MediaWiki hosting account. If the application is installed directly in the public_html directory on the account, meaning the frontend is accessible at, then the path to the file on the account will be public_html/LocalSettings.php. HostKnox customers can view and edit files directly on their accounts from the File manager of the Pixie control panel. Another way is to download the file on your local computer, edit it with a text editor (e.g. Notepad) and upload it back.

Was this answer helpful?

 Print this Article

Also Read