views:

870

answers:

5

What combination of html and IE8 settings get IE8 to open links in a new tab. Or can you not do this with IE8, and you only get the new tabs by manually selecting File-> new/duplicate tab?

My website works in Firefox - pages on the site load in the current tab, and links off site load a new tab. IE8 won't behave: target="_blank" opens a whole new window; the other options, _self _top _parent, all open the page in the current tab.

I have Firefox set to "Open new windows in a new tab." The links to pages on my site all have target="_self" and Firefox keeps these in the current tab. On the external links I don't have a target set (I added _blank to see if it fixed IE8, and doing that didn't affect Firefox).

I can't find an equivalent setting in IE8. Tools-Internet Options-General-Tabs/Settings has an enable tabs box, and a sub-option to automatically switch to newly opened tabs. Is there some html that will work? An IE8 setting I'm missing?

Any help appreciated.

+3  A: 

It is not a thing you can control from HTML code, as it should be user's, not document author's decision how to open a link.

To open pop-up windows in new tab, follow instructions from IE8 help:

To change how pop-ups are displayed

In Internet Explorer, click the Tools button, and then click Internet Options. Click the General tab, and then, in the Tabs section, click Settings. Make a selection in the When a pop-up is encountered section. Click OK twice.

Updated: Reading OPs comments to other posts, it seems like the intent is to make all external links open in new tabs. However, it is not document author's choice how the client should open any link in any page - it has to be decided by the client. Moreover, even though you can create a client-side script which sets "target" property to open pop-up windows, there is no notion of "tab" in Document Object Model and hence you cannot do it even in a script.

naivists
I'm not talking about pop-ups. I hate them, and would never try to bother somebody with one. I understand it should be a browser setting. IE8 has tabs. How do I make them work?
Rilien
updated my post
naivists
Updated your post, and didn't address the question. The question: IE8 has tabbed browsing. What combination of html and IE8 settings, if any, will cause the external links on my site to open in a new tab? -OR does IE8 only open new tabs when you manually do File->new/duplicate tab?
Rilien
similarly to other contemporary browsers, IE opens a link in new tab if you hold *Ctrl* key when you click a link. There is no specific value of `target` attribute which you could use, as HTML was invented a decade before tabs became popular.
naivists
+1  A: 

How the browser interprets the target is browser dependent - each vendor will specify what they want. Firefox decided to use a new tab, IE decided to use a new window.

The html 4.01 spec has this to say on "_blank":

The user agent should load the designated document in a new, unnamed window.

The spec predates the wide usage tabbed browsing now has, so doesn't mention the concept anywhere.

Oded
IE8 has tabbed browsing. What combination of html and IE8 settings will cause the external links on my site to open in a new tab?
Rilien
None. IE does not distinguish "internal" links from external ones.
naivists
I wouldn't expect it to. The html settings (target=) are different for the internal and external links - which I said.
Rilien
+1  A: 

Opening a page in a new tab is concept that believe is not covered by the html standard. The Firefox behavior is just a setting in the browser, which IE8 might or might not have.

On a related note, I personally find it abusive of websites to make the choice of opening a page in a new tab/window. What if I want it to open in the current tab/window?

Of course, in a rich application-like site that is basically entirely an application I find it convenient that pages open in a new tab/window. This makes them work more like desktop apps

For normal pages, I would suggest not setting the target at all and let the user decide.

Simon Lindgren
IE8 has tabbed browsing. What combination of html and IE8 settings will cause the external links on my site to open in a new tab?
Rilien
@erynion - Sorry, that I do not know. My point is that you, the developer, should not care about that. If the user wants it to be in a certain way, they will adjust their settings or switch browser. The only thing you can do is to do what you have done, namely add target="_blank" to the links. Then again, I'm kind of against that as well, since you remove the users choice by doing that.
Simon Lindgren
+1  A: 

I think W3.org is still working on this issue, but it isn't implemented in any browser yet. Also remember that Internet Explorer will be the last browser to implement it ;)

This is code copied from a W3 Working Draft:

/* If a user wanted to have new windows open in new tabs instead, she could use the following user style sheet to do so: */

* { target-new: tab ! important }

Of course, it is impossible to set user preference in HTML or Javascript -- it would be unsafe.

Harmen
Are people saying that the only way IE8 opens a new tab is when you manually do File->new tab/duplicate tab? If not, what combination of html and IE8 settings open a link in a new tab in IE8?
Rilien
@erynion - Nope. The user can open a link in a new tab by middle button clicking, or by selection from the context menu. No need to change HTML at all.
Alohci
An easy answer, that was very hard to get. Thank you.
Rilien
+1  A: 

The answer to the question is in the comments. Now you can test it in IE8 - just use the middle mouse button to open the link in a new tab. Firefox does work better with tabs.

elmer