[Mediawiki-l] External Link Opening in New Tab or Window

Charlie Markwick charlie-markwick at southcot.com
Thu Jan 27 09:38:00 UTC 2011


-----Original Message-----
From: Charlie Markwick 
Sent: 24 January 2011 16:25
To: 'MediaWiki announcements and site admin list'
Subject: RE: [Mediawiki-l] External Link Opening in New Tab or Window

I've added this 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.

-------------------------------

/* Any JavaScript here will be loaded for all users on every page load.
*/

// 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 );


Charlie



More information about the MediaWiki-l mailing list