views:

100

answers:

3

I know target="_blank" is supposed to make the thing open in a new window, and for some browsers, like FF3, it will actually make it open in a new tab. Is there a way to exercise more control over this behavior as a developer?

+10  A: 

According to https://developer.mozilla.org/En/Window.open, """ How do I open a referenced resource of a link in a new tab? or in a specific tab?

Currently, you can not. Only the user can set his advanced preferences to do that. K-meleon 1.1, a Mozilla-based browser, gives complete control and power to the user regarding how links are opened. Some advanced extensions also give Mozilla and Firefox a lot of power over how referenced resources are loaded.

In a few years, the target property of the CSS3 hyperlink module may be implemented (if CSS3 Hyperlink module as it is right now is approved). And even if and when this happens, you can expect developers of browsers with tab-browsing to give the user entire veto power and full control over how links can open web pages. How to open a link should always be entirely under the control of the user. """

Alex Martelli
That's pretty much the answer I was starting to type.
Dennis Palmer
+1  A: 

Whether something targeted to "_blank" opens to a new tab or window is a browser/user specific option settable in most new tab supported browsers. There is no way to target a tab yet.

kscott
+2  A: 

Currently the final decision on how to open a link is in the hands of the user and their browser.

Also, I wouldn't be too happy if a developer overrode my choice in the way that you are describing. I only ever want one browser window open at a time, and do not want child windows to appear. Other people feel much the opposite. We should try to respect that as developers.

Matthew Vines
Agreed. I'm often asked to force links to open in new windows but really we should be educating users to CTRL + click. Website owners are desperate to keep people on their site!
David Caunt