views:

81

answers:

3

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

+1  A: 

No, there isn't.

David Dorward
+7  A: 

There is no way to do that as the author of the HTML that runs in a browser. At least not yet, or that I know of. Its pretty much up to the browser and its settings.

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

Its a good thing we can't do certain things. We seen over abuse of target=_blank and popups done to death.

Moin Zaman
+1! By default most browsers open `target = "_blank"` in new tab, but in the old days, it would open a new window. There, I think, is no way to force links to open in new tab.
Tom
A option to define which links should open in a new tab/window should exist. This is convenient for external links. I believe that everybody agrees that opening the link in a new tab is the desired method for most users. IE and Safari open _blank's in new windows for some reason, but that is probably a legacy behavior and has nothing to do with the user's preferences. I believe that most users even don't know how to set this behavior in their browsers.
Šime Vidas
The simple solution is not to try to force your links to open in a new tab *or* a new window. If I want a new tab, I'll middle-click, thanks.
bobince
@bobince What about external links? If I (as the owner of the web-site) want to provide a link to an external page (as in an article), but I don't want the visitor to navigate away (nor does the visitor (!!)), then there should be a method do accomplish this.
Šime Vidas
The visitor decides when they are going to leave your site, not you, so it doesn't matter if you don't want them to leave. If the visitor doesn't want to leave then they can middle click (as @bobince already indicated). If they leave and want to come back then they have a back button … and a browser history … and a bookmarks menu … and probably the ability to simply find the site again.
David Dorward
A: 

The way the browser handles new windows vs new tab is set in the browser's options and can only be changed by the user.

Andrew W.