Create a gist now

Instantly share code, notes, and snippets.

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