My two cents about software development on the web


Markdown link targeting to new window

source: markdown target=“_blank”

Is there a way to create a link in markdown that opens in a new window?

This is the answer I like. I added this script in the footer of the page so every link that points outside my own site is opened in a new window.

var links = document.links;

for (var i = 0, linksLength = links.length; i < linksLength; i++) {
   if (links[i].hostname != window.location.hostname) {
       links[i].target = '_blank';

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>