[Mediawiki-l] External Link Opening in New Tab or Window
Charlie Markwick
charlie-markwick at southcot.com
Mon Jan 24 15:04:02 UTC 2011
-----Original Message-----
From: mediawiki-l-bounces at lists.wikimedia.org
[mailto:mediawiki-l-bounces at lists.wikimedia.org] On Behalf Of nakohdo
Sent: 21 January 2011 19:57
To: mediawiki-l at lists.wikimedia.org
Subject: Re: [Mediawiki-l] External Link Opening in New Tab or Window
Just put the following JavaScript code in your wiki's
MediaWiki:Common.js page:
// Anything in this function wrapper will be executed when the page is
ready for action
( function( $ ) {
$( document ).ready( function() {
// Open external links in the sidebar in a new window
$( '#mw-panel, #panel' ) // #panel is for pre-1.17 compatibility
.find( 'li a' )
.filter( '[href^=http://], [href^=https://]' )
.attr( 'target' , '_blank' );
} );
} )( jQuery );
-------------------------------
I've added it to MediaWiki:Common.js but it changes nothing. I have
tried clearing the cache and also accessing the URL using another
browser that hasn't accessed the wiki before. No difference.
More information about the MediaWiki-l
mailing list