window.blur() not working with Firefox 4

2019-02-24 23:50发布

I have a function that when activated opens a new window as a pop-under under the current browser window. It was working fine with all past version of IE and FF, now it has stopped working. Apparently Mozilla has changed one of the setting of FF 4 to prevent this: http://support.mozilla.com/en-US/questions/806756

Here is the code I am using:

function popup(page) {
    var myWin = window.open(page,"mywindow","menubar=1,resizable=1,status=1,toolbar=1,location=1,directories=1,scrollbars=1");
    opener = myWin.blur();
}

How can I get this code to work on FF 4?

2条回答
三岁会撩人
2楼-- · 2019-02-25 00:28

Doesn't look like you have control over this behavior...

http://support.mozilla.com/en-US/questions/806756#answer-167267

查看更多
SAY GOODBYE
3楼-- · 2019-02-25 00:31

It seems to work if you make the popup create another child window, close it, then blur the popup window. Like so:

var win = window.open(...);
win.window.open('about:blank').close();
win.blur();
window.focus();
查看更多
登录 后发表回答