gareth-gillman
8/30/2016 - 10:19 AM

Checks links on a website for the _blank attribute and adds the noopener and noreferrer tags if they don't exist - see https://dev.to/ben/th

Checks links on a website for the _blank attribute and adds the noopener and noreferrer tags if they don't exist - see https://dev.to/ben/the-targetblank-vulnerability-by-example

$(document).ready(function(){
 $('a').each(function() {
  if(
			$(this).attr('target') == '_blank' || 
		 $(this).attr('rel') == 'noopener' || 
			$(this).attr('rel') == 'noreferrer' ) {
    $(this).attr('rel', 'noopener noreferrer');
  }
 });
});