HTML link in a new window

 

HTML link in a new window

How to open a link in a new window or new tab.

Open a link in a new window or tab

In order to open a link in a new window / tab, add target="_blank" inside the <a> tag:

<a href="../html-link.htm" target="_blank">Open page in new window</a>

The code will create this link:

Open page in new window

 

New window or new tab

You can't set whether the link will be opened in a new window or new tab. It depends on the browser's  settings. 

 

Open a link in a new window with specified size

In order to open a link in a new window, add Javascript command onclick="window.open('text-link.htm', 'name','width=600,height=400') inside the <a> tag:

<a href="../html-link.htm" target="popup" onclick="window.open('../html-link.htm','name','width=600,height=400')">Open page in new window</a>

The code will create this link:

Open page in new window

 

See also

©️ 2024 CalculatorX. All rights reserved.