5
votes

I want a script that makes a user's Internet Explorer open a new tab instead of a new window whenever someone clicks on a (target="_blank") link/banner on my webpage.

I hate how Internet Explorer defaults to opening new windows instead of new tabs when a link/banner is clicked. All the other popular browsers (e.g. Chrome, Opera, Firefox) open tabs by default.

Preferably this script would need to work in all versions of IE that support tabs.

So... How to, using JavaScript force IE into opening new tab instead of window, which is it's default behaviour?

3
not possible... (and it is a good thing that you cannot override user preferences..)Gabriele Petrioli
The current version of IE doesn't open _blank links in new windows, but new tabs. What version of IE did you test in?Šime Vidas

3 Answers

2
votes

This isn't possible; it's a browser setting/behavior which is not callable from a script loaded on the page.

Programmatically open new pages on Tabs

0
votes

In IE11 at least, the default user setting is to 'Let Internet Explorer decide how popups should open' (Off-hand, I'm not sure what the default was in previous versions). Some context around the IE behaviour with this default setting can be found here: https://superuser.com/questions/713743/what-rules-apply-when-ie9-decides-how-to-open-popups

Per others' answers/comments here, generally speaking, we as web programmers have little control over how popups are opened. However, provided users have not changed their default selection (in IE11 at least!), you can approximate the behaviour you want through appropriate invocation of the window.open() method. Specifically, if you pass less than three arguments to the method, IE will generally open a new tab, while passing the specs (third) argument (even if with a null or undefined value <- this caught me out initially!) results in IE popping a separate window.

If you're happy to live with a solution that isn't guaranteed but works a fair amount of the time, this may help. The 'tyranny of the default' works in our favour in this instance at least!

Chrome at least is not quite so picky about the specs argument - if null or undefined, it will pop the tab instead of the window under default configuration.

0
votes

What I did was to go to the tab settings of IE and under the section 'When a pop-up is encountered' select 'Always open pop-ups in a new tab'. I hope this helps.

To navigate to this menu open IE settings (Cog icon at the top-right, Internet Options) and click the tabs button under the Tabs section.

The below post show you how to navigate to the menu in the screenshot.

https://superuser.com/questions/507798/prevent-a-single-ie-window-with-multiple-open-tabs-from-being-displayed-as-multi

IE Settings