Is there a way to get all external links to open in a new tab?

Thanks for sharing, I just do the same with an improved code on a similar topic, because origin.indexOf(domain) === -1 can be bypassed.

If your domain is example.com, a malicious link to badexample.com would match because indexOf finds the substring and returns a position (not -1)

I want my external links to open in a new tab - #66 by satonotdead

Perhaps the topics can be merged mixing the different techniques and detailing their pro/cons.