Skip to main content
Home / Code Snippets / HTML / Open Link in a New Window

Open Link in a New Window

HTML attribute (valid in HTML5 now):

<a href="http://chriscoyier.net" target="_blank">This link will open in new window/tab</a>

Inline JavaScript way:

<a href="http://chriscoyier.net" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;">This link will open in new window/tab</a>

With jQuery:

See here

icon-link icon-logo-star icon-search icon-star