Opening new window in HTML for target="_blank"

TIMEX picture TIMEX · Mar 29, 2010 · Viewed 172.3k times · Source
<a href="facebook.com/sharer" target="_blank" >Share this</a>

How do I make this a certain width and height, in a new window, when the user clicks on it? In firefox, the current code only opens up a new tab (not a new window)

Answer

Marcos Placona picture Marcos Placona · Mar 29, 2010

To open in a new windows with dimensions and everything, you will need to call a JavaScript function, as target="_blank" won't let you adjust sizes. An example would be:

<a href="http://www.facebook.com/sharer" onclick="window.open(this.href, 'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" >Share this</a>

Hope this helps you.