(T143849) Use rel="noopener noreferrer" on external links with _blank target to prevent window.opener phishing (See https://dev.to/phishing) - per m:User:BWolff (WMF)
(Založena nová stránka s textem „// ********************************************************************** // ** Udělátko umožňující otevírání externích odkazů v novém okně.…“) |
*>Krenair ((T143849) Use rel="noopener noreferrer" on external links with _blank target to prevent window.opener phishing (See https://dev.to/phishing) - per m:User:BWolff (WMF)) |
||
Řádek 15: | Řádek 15: | ||
if (this.href.indexOf(location.protocol + '//' + location.hostname) !== 0) { | if (this.href.indexOf(location.protocol + '//' + location.hostname) !== 0) { | ||
this.target = '_blank'; | this.target = '_blank'; | ||
if ( this.rel.indexOf( 'noopener' ) < 0 ) { | |||
this.rel += ' noopener'; // the leading space matters, rel attributes have space-separated tokens | |||
} | |||
if ( this.rel.indexOf( 'noreferrer' ) < 0 ) { | |||
this.rel += ' noreferrer'; // the leading space matters, rel attributes have space-separated tokens | |||
} | |||
} | } | ||
}); | }); | ||
}); | }); |