Created
July 11, 2013 19:40
-
-
Save eliezerb/5978560 to your computer and use it in GitHub Desktop.
JavaScript function to make external links open in new tabs, using Jekyll without HTML explicit tag on markdown files.
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
// Make external links open in new tabs without target property in html | |
$('a').each( function( index , element ) { | |
if( !element.href.contains(document.location.host) ) { | |
element.target = '_blank'; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment