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.
The mozilla team says this behaviour is by design and will not be fixed. See above links for discussion.