JavaScript open in new tab

10.Aug.2010

To use JavaScript to open link in new tab (or window), just use following code. The right way would be to write it with handler on click event, but this way snippet is easier to read.

<a href="http://example.com" onclick="window.open('example.com', '_blank'); return false;">
	JavaScript open in new tab
</a>

That’s all.