MediaWiki:Gadget-exlinks.js
Nota: Depois de publicar, deve limpar o cachê do seu navegador para ver as alterações.
- Firefox e Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
- Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
- Internet Explorer e Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5
- Opera: Pressione Ctrl-F5.
mw.hook('wikipage.content').add(function($content) {
$content.find('a.external, a[rel="mw:ExtLink"]').each(function () {
if (this.href.indexOf(location.protocol + '//' + location.hostname) !== 0) {
this.target = '_blank';
if ( this.rel.indexOf( 'noopener' ) < 0 ) {
this.rel += ' noopener';
}
if ( this.rel.indexOf( 'noreferrer' ) < 0 ) {
this.rel += ' noreferrer';
}
}
});
});