Open a new tab in Firefox

I have this code that opens all the links on my page in a new window:

<base target='_new' />

It works fine in Chrome, but not so in IE (8) and Firefox. In Firefox, it opens a new tab, but on the second link it loads into a new tab, but without placing this tab in front, so the user will need to click on the new tab. In IE, a new browser window opens. Is there equivalent code (..js / jquery) to open in a new tab in all browsers?

+3
source share
4 answers

There is no guarantee that the browser will open this new window / tab. different browsers open new windows / tabs in different ways, and browser settings can also influence this behavior.

+6
source

Firefox .

Tools -> Options -> Tabs, 
    "When I open a link in a new tab, switch to it immediately"

IE9

Tools -> Internet Options -> General -> Tabs Settings
    "Always switch to new tabs when they are created"

IE9 , .

Tools -> Internet Options -> General -> Tabs Settings
    "When a popup is encountered"
     - Let Internet Explorer decide ...
     - Always open popups in a new tab
     - Always open popups in a new window

http://windows.microsoft.com/en-US/windows7/Tabbed-browsing-frequently-asked-questions

If you opt to let Internet Explorer decide how to display pop-ups, it 
will display the pop-up in a new window if the pop-up specifies size 
or display requirements. Otherwise, the pop-up is displayed in a new tab.

, , .

+4

( ). . , , : - .

+1

, "base", "target" , , .

:

  • _blank:
  • _self: , ( )
  • _parent:
  • _top:

(http://www.w3schools.com/tags/att_a_target.asp)

, , , . .

Thus, using "_new" (which is not a keyword) as the base target, you are essentially saying that all links should be open in a window named "_new". At first, this window does not exist, so the browser creates it (first click), and it reuses it for all subsequent clicks.

Use "_blank" so that each link opens in its own new tab.

0
source

All Articles