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

nakohdo Frank.Ralf at gmx.net
Fri Jan 21 19:57:17 UTC 2011



Charlie Markwick wrote:
> 
> See
> http://www.mediawiki.org/wiki/JQuery_snippets#External_links_in_Sidebar_
> in_new_window
> 
> Can anyone help me understand how to use the suggestion in this link.
> I'm not sure where to start.
> 

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





-- 
View this message in context: http://old.nabble.com/%22Category%3A-Noindexed-pages%22-puzzle-tp30698862p30732208.html
Sent from the WikiMedia General mailing list archive at Nabble.com.




More information about the MediaWiki-l mailing list