Created
April 15, 2016 06:35
-
-
Save raulanatol/dee7b84d0a0a1317c149537413595d32 to your computer and use it in GitHub Desktop.
Automatic target="blank" to external links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mainURL = location.protocol + '//' + location.host; | |
$('a').not(':contains(mainURL)').click(function(){ | |
this.target = "_blank"; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment