Last active
March 18, 2017 00:29
-
-
Save bootjp/8bed64326a294044b51660d5729c6782 to your computer and use it in GitHub Desktop.
append noopener.js
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
Array.prototype.slice.call(document.getElementsByTagName('a')).forEach(function(element) { | |
if (element.target === '_blank' && element.rel.indexOf('noopener') === -1) { | |
element.rel += ' noopener'; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment