<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)
The target attribute set to _blank , which tells the browser to open the link in a new tab/window, depending on the browser's settings.
Value. Description. _blank. Opens the linked document in a new window or tab.
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.
The first method requires a keyboard and a mouse or trackpad. Simply press and hold the Ctrl key (Cmd on a Mac) and then click the link in your browser. The link will open in a new tab in the background.
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.
You can't influence neither type (tab/window) nor dimensions that way. You'll have to use JavaScript's window.open() for that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With