Home » Core Java » How to Open a Link in a new browser window

How to Open a Link in a new browser window

For Opening a Link in a new browser window, use target attribute of <a> html tag.

target attribute specifies the where the new browser window will open.

There are different values of target attribute of <a> html tag.

_blank    --- It tells that the link will open in the new browser window.
_parent   --- It tells that the link will open in the parent browser window. 
_self   --- It tells that the link will open in the same browser window. 
_top   ---- It tells that the link will open on the top of current browser window. 



Demo HTML for Opening a Link in a new browser window:

<!DOCTYPE html>
<html>
<head>
   <title> Demo HTML for Opening in New Browser Window </title>
</head>
<body>
  Click on the link below to open in new browser window.<br/>
  <a href="http://www.mathapachi.com" target="_blank"> Mathapachi.com</a>
</body>
</html>

When You click on the below link Mathapachi.com, then it would open up in a new browser window.target=”_blank” tells the browser to open the link in new HTML Browser Window.

New Browser Window Demo