Last active
August 29, 2015 14:07
-
-
Save abrudtkuhl/94a6f58d1f76439fa6fb to your computer and use it in GitHub Desktop.
jQuery Open Files In New Window
This file contains hidden or 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
// Regex via http://stackoverflow.com/a/6582227/12442 | |
// jQuery Filter idea via http://stackoverflow.com/a/193787/12442 | |
jQuery(function() { | |
jQuery('a').filter(function() { | |
return this.href.match(/\.([0-9a-z]+)(?:[\?#]|$)/i); | |
}).prop('target', '_blank'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment