Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Open all external links in a new window
@YupItsZac

This comment has been minimized.

Copy link

commented Nov 16, 2015

Nice gist, @wpscholar. I wrote a jQuery plugin for this that includes several options for customizing the way external links and files are handled.

https://github.com/YupItsZac/jQuery.exLink

@wpscholar

This comment has been minimized.

Copy link
Owner Author

commented Sep 21, 2017

Updated gist to support "noopener noreferrer". See https://medium.com/@jitbit/target-blank-the-most-underestimated-vulnerability-ever-96e328301f4c for details.

@mpiprojects

This comment has been minimized.

Copy link

commented Jan 2, 2018

Assuming I can add "nofollow" to the rel attribute as well. Could you give me an example script on how to add an exception, for when the A tag has class=trusted? Where only the target attribute is set and the rel attribute is left empty. Many thanks and happy new year!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.