Reputation: 2898
I have a simple page:
<html>
<head>
<script type="text/javascript">
function popUnder() {
var adv = window.open('http://google.com', '_blank', 'status = 1, height = 600, width = 600, resizable = 1');
adv.blur();
window.focus();
}
</head>
<body onclick="javascript: popUnder();">
...
</body>
</html>
But pop-under not works in Firefox 9. On this page https://bug369306.bugzilla.mozilla.org/attachment.cgi?id=296123 all of windows are pop-ups when dom.disable_window_flip == true. What is the simplest and right way to create pop-unders? Or it is no solutions for creating pop-unders in Firefox with window.open?
Upvotes: 1
Views: 6504
Reputation: 21
this behaviour was introduced with Firefox 4.
This workaround: https://gist.github.com/1021924 still works in FF10.
Upvotes: 2
Reputation: 1702
so i've actually hacked away and got something somewhat working in Firefox. i have to say that this was very fast and very ugly, but i don't think i've ever given a good (or even decent) answer on here so may as well try to start. :P also, i should state that i'm triggering the pop under on submission of a form but you could trigger it on page load if you wanted. i have the booleans in there to ensure it doesn't pop under more than once. if anyone wants to clean up my code and show a more straight forward solution (i.e. without multiple booleans/functions and the setTimeout) i'm sure we'd all be grateful.
var submitted = false;
var redir = false;
function do_window_location() {
if(submitted == false) {
$('form').submit();
submitted = true;
}
window.location = 'http://www.google.com';
}
function call_window_location() {
if(redir == false) {
setTimeout('do_window_location()', 100);
redir = true;
}
}
$('document').ready(function() {
$('form').submit(function() {
if(submitted == false) {
call_window_location();
$(this).submit();
submitted = true;
}
});
return true;
});
hope this helps someone in some fashion.
Upvotes: -1