Created
March 28, 2018 08:11
-
-
Save mahfuzul/4ab198ef8a42b38cea6faad0daaca666 to your computer and use it in GitHub Desktop.
JS: Third party links will be opened in a new tab/window
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
// Third party links will be opened in a new tab/window | |
$("a").filter(function () { | |
return this.hostname && this.hostname.replace('www.', '') !== location.hostname.replace('www.', ''); | |
}).attr('target', '_blank'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment