3
votes

This seems to be a strange change of functionality since Firefox 4. After opening a window with window.open(), when clicking links in the opened window with the middle mouse button (or right-clicking and selecting 'open in new tab') results in the link being opened in a new tab in the old window.

In Firefox 3, the tab would have opened in the new window.

Example code, index.html:

<html>
    <head>
        <script type="text/javascript">
            function foo() {
                var w = window.open('page2.html', 'foobar', 'target=_blank');
            }
        </script>
    </head>
    <body>
        <a href="#" onclick="foo()">bar</a>
    </body>
</html>

page2.html:

<html>
    <head />
    <body>
        <a href="www.google.com">google</a>
    </body>
</html>

After opening page2 from index.html and middle-clicking the google link, a new tab appears in the window that contains index.html.

Does anyone know how to fix this?

EDIT: Chrome does the same thing.

2
I think you misunderstood the question. Opening new windows or tabs isn't the problem. The new tab being opened in the wrong window is.Tim Lamballais
Ah yes, you're right, I missed the italicized part. ;) I don't know what to do about it (and I fear you can't, at least not using specific code and markup), but you can always file a bug report.Marcel Korpel
Ctrl-Click exibits the same issue. It appears to be a bug.DwB

2 Answers

0
votes

The mozilla team says this behaviour is by design and will not be fixed. See above links for discussion.