Skip to content

Instantly share code, notes, and snippets.

@Shakil-Shahadat
Last active December 18, 2021 01:50
Show Gist options
  • Save Shakil-Shahadat/10f3415fa626565c11c69e46bfee04c7 to your computer and use it in GitHub Desktop.
Save Shakil-Shahadat/10f3415fa626565c11c69e46bfee04c7 to your computer and use it in GitHub Desktop.
Add target="_blank" attribute to all anchor tags
// Add target="_blank" to all anchor tags, v 1.05
for ( x of document.querySelectorAll( 'a' ) ) x.setAttribute( 'target', '_blank' );
@Shakil-Shahadat
Copy link
Author

  • Move this to miscellaneous.js.
  • Change target to something safer.
  • Update version number to 2.0 after doing that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment