Open external links in new tabs

There are a few methods of setting links to different websites open in a new tab. Here’s a simple jQuery snippet I wrote that filters through elements and sets each one’s attribute to _blank (new tab) if the link’s domain differs from the current domain:

See the Pen Open External Links in New Window by Tony Ciccarone (@tciccarone) on CodePen.


Interested in "Open external links in new tabs"?