How to open a new tab or window when clicking a link?

I have the same ancors / hyperlink in my html file. They point to a new site outside of my site. Therefore, I want the user to click a link to open a new tab or window. My page should not be closed.

How can I do that?

+4
source share
5 answers
<a href="newpage.htm" target="_blank">Click me to open in a new tab/window</a> 

Load the linked document in a new blank window. This window is not by name.

If there is no existing window or a frame with the same name as indicated in the target window, a new window opens with a name equal to the target value.

Its parameter in the browser determines whether to open the page in a new tab or in a new window.

+7
source

open in tabs: there is nothing software that you can do for this, the only thing I think about is to install a browser to open new links in tabs instead of a new window ...

To open in a new window all you need is to place the target in your anchors.

 <a href="mydomain.com" target="_blank">click here</a> 

and by the way, for the purpose there are more opportunities

 target="_blank" 

opens in a new window Empty

 target="_parent" 

opens in the Parent window (used when working with iframes and you want to open the link in another frame)

 target="_self" 

opens its own / self window in it (used when working with iframes and you want to open the link in the current frame)

 target="_top" 

opens to the top of all frames (it will open on top of all frames on the page, how the page will be displayed without a frame)

+10
source

Just add target = "_ blank" in the <a> tag

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

The easiest way is to use the target attribute in your anchors and set it to _blank :

 <a href="http://www.worsethanfailure.com/" target="_blank">Worse Than Failure</a> 
+1
source

This is a hoax of opening links in the same window or in a new (tab) and https://stackoverflow.com/questions/118567/is-there-ever-a-good-reason-to-force-opening-a-new-browser -window . In principle, no. And there should be no way - you should not impose your surfing preferences on unsuspecting others.

0
source

All Articles