Click here will exit t...">

Opening an external website in a new tab / window / popup

I know that I click on:

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

will exit the current page and go to this address, and

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

will open it in a new tab (default behavior in Chrome and Firefox).

But how to create a button so that clicking on it opens an external website in a new browser window, perhaps 700x500px? (for example, if you make a new window in the Chrome menu)

+1
source share
1 answer

You cannot do this with pure HTML - you need JavaScript to get the result.

 <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 blocking pop-ups.

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

+3
source

Source: https://habr.com/ru/post/1275714/


All Articles