Skip to content

Instantly share code, notes, and snippets.

@abrudtkuhl
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abrudtkuhl/94a6f58d1f76439fa6fb to your computer and use it in GitHub Desktop.
Save abrudtkuhl/94a6f58d1f76439fa6fb to your computer and use it in GitHub Desktop.
jQuery Open Files In New Window
// 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