Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 2

Can't get links to open in new tab (bis)

Sorry to create a new post about this but the issue seems very old and was posted in many places (eg. https://github.com/mojombo/github-flavored-markdown/issues/28) and I could not find a way to make target="_blank" work in a html link yet.

 

I do not like that users leave the github page when clicking such link and would prefer that they get a new tab to see the result.

 

My example would be like this:

 

blah blah <a href="http://htmlpreview.github.com/?https://github.com/<repo>/<path>/blob/master/<my html file.html" target="_blank">comment</a>**

 

It now does display the html content all right, but in the current tab rather than in a new one as I would prefer it to behave.

 

Thanks for any code snip to achieve this or ro add this as a feature requests.

 

Stephane

1 Reply
Highlighted
Community Manager
Message 2 of 2

Re: Can't get links to open in new tab (bis)

Any HTML that is inserted into Markdown to be displayed on a GitHub page is sanitized to prevent security problems. The `target` attribute on the `a` tag is one of those items that gets stripped out. Unfortunately, there isn't a solution for this.

 

I hope that helps.