Created
April 15, 2018 17:34
-
-
Save anavdesign/2fbf6b273707e5d9da6d77491741eee5 to your computer and use it in GitHub Desktop.
jQuery: Open External Links New 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
/** | |
* Open All External Links In New Window | |
*/ | |
(function ($) { | |
'use strict'; | |
$('a').filter(function () { | |
return this.hostname && this.hostname !== location.hostname; | |
}).attr('target', '_blank'); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment