1

I know that clicking on:

<a href="http://www.example.com">Click here</a>

would quit the current page and go to this address, and that

<a href="http://www.example.com" target="_blank">Click here</a>

would open it in a new tab (default behaviour in Chrome and Firefox).

But how to have a button such that clicking on it would open the external website in a new browser window, possibly 700x500px? (like if you do New window in Chrome menu)

Basj
  • 41,386
  • 99
  • 383
  • 673

1 Answers1

4

You cannot do that with pure HTML - to achieve the result you need JavaScript.

<a href="http://www.example.com" onclick="window.open('http://www.example.com', 
                                         'newwindow', 
                                         'width=700,height=500'); 
              return false;">Click here</a>

However, this solution is vulnerable to be pop-up blocked.

As @Rob M. suggested, here you can read everything about window.open().

Tomasz Bubała
  • 2,093
  • 1
  • 11
  • 18
  • beat me to it, here's a link to the docs for further reading: [link](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) – Rob M. Feb 28 '18 at 17:47