Last active
December 1, 2017 17:19
-
-
Save kemayo/fc60e10d343fa03a7c909065deb46e02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function ( $ ) { | |
$.fn.openInNewWindow = function () { | |
var rel; | |
if ( this.tagName.toLowerCase() === 'a' ) { | |
this.setAttribute( 'target', '_blank' ); | |
rel = this.getAttribute( 'rel' ); | |
this.setAttribute( 'rel', rel ? ( rel + ' noopener' ) : 'noopener' ); | |
} | |
} | |
)( jQuery ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment