Javascript-click on the url with the opening of a new tab

Good afternoon.

window.location.href = "my.url"

This code opens the url on the same page, but how do I open a new tab?

Thanks.

Author: Jenkamen, 2011-03-15

2 answers

Use the open{[2] method]}

window.open('http://example.com');
 14
Author: rnd_d, 2011-03-15 09:44:18

Or target= "_blank"

 2
Author: chuikoff, 2011-03-15 12:28:26