Skip to content

Instantly share code, notes, and snippets.

@bootjp
Last active March 18, 2017 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bootjp/8bed64326a294044b51660d5729c6782 to your computer and use it in GitHub Desktop.
Save bootjp/8bed64326a294044b51660d5729c6782 to your computer and use it in GitHub Desktop.
append noopener.js
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