Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML: how to force links to open in a new tab, not new window [duplicate]

I use target="_blank" to open links in a new tab. But in IE it opens a new window which is completely logical because that is what _blank is supposed to do.

And i don't know how target="_blank" behaves in other browsers.

Is there something to force links to open in a new tab. If the browser supports tabs... else make a new window

like image 770
Moon Avatar asked Oct 19 '10 16:10

Moon


People also ask

How do I make a link open in new tab instead of new window?

To open a link in a new browser window, hold the Shift on then click the link or right-click the link and select Open link in New Window.

How do I force a link to open in a new tab in HTML?

You can make a HTML link open in a new tab by adding the target=”_blank” attribute. You should insert this after the link address.

How can you open a link in its own unique new window?

You just need an anchor ( <a> ) element with three important attributes: The href attribute set to the URL of the page you want to link to. The target attribute set to _blank , which tells the browser to open the link in a new tab/window, depending on the browser's settings.

How do I force a link to open in the same tab?

Use _self in target attribute of anchor tag to Open link in same tab in HTML webpage.


1 Answers

There is no way to do that as the author of the HTML that a browser renders. At least not yet that I know of. Its pretty much up to the browser and its settings / preferences that are set by users themselves.

Also, you shouldn't impose this upon any user. A browser is the user's property. If a user wants to open all links in tabs or in new windows, then let the user do exactly that.

It's good that we can't do certain things. target=_blank is still abused and popups have been done to death.

like image 180
Moin Zaman Avatar answered Sep 21 '22 17:09

Moin Zaman