Question

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.

Was it helpful?

Solution

The answer to the question was posted in the comments (but is now deleted). 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.

OTHER TIPS

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.

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.

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top