Last active
November 15, 2017 14:18
-
-
Save dennisroche/11cb0195f04b24951a1ee04aa969370e to your computer and use it in GitHub Desktop.
Modify external links to open in a 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
$.expr[':'].external = function(obj) { | |
return !obj.href.match(/^mailto\:/) && (obj.hostname != location.hostname); | |
}; | |
$('a:external').attr({ | |
target: "_blank", | |
title: "Opens in a new window" | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment