Open links in new window


#1

Do you know I can set my external links to open in a new window?


#2

There is no such feature in markdown, however you can always use HTML inside markdown:

<a href="http://example.com/" target="_blank">example</a>


#3

Juut add a target="_blank" attribute to your links (anchor tags). Now when your visitors click that link.

You may specify the window size by adding few javascript.

Example :

<a onclick="window.open(document.URL, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');">
  Share Page
</a>

#4

You could also add some javascript to make all external links open in a new tab automatically:

$('a').each(function() {
    var a = new RegExp('/' + window.location.host + '/');
    if(!a.test(this.href)) {
        $(this).click(function(event) {
            event.preventDefault();
            event.stopPropagation();
            window.open(this.href, '_blank');
        });
    }
});