Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open button in new window?

How would I go about making the button open in a new window, emulating "a href, target = _blank"?

I currently have:

<button class="button" onClick="window.location.href='http://www.example.com';">       <span class="icon">Open</span> </button> 

The button isn't in a form, I just want to make it open in a new window.

like image 498
Latox Avatar asked Jan 10 '11 05:01

Latox


People also ask

How do I make a link open in a new window?

Open in a new window To open a link in a new browser window, hold the Shift on then click the link or right-click the link and select Open link in New Window.


1 Answers

Opens a new window with the url you supplied :)

<button class="button" onClick="window.open('http://www.example.com');">      <span class="icon">Open</span> </button> 

hope that helps :)

like image 142
Damien-Wright Avatar answered Oct 04 '22 06:10

Damien-Wright