工作,我需要打开一个弹出窗口,然后关闭后弹出窗口(刷新父页)的JavaScript“beforeunload”事件不是在IE
jQuery的“beforeunload”事件在Internet Explorer 8中无法正常工作,9。
我的代码是:
/*
* events
* add tallyman
*/
$("div.main form div.tallymanlist").click(function() {
if(gencargo.show_confirm('Add new tallyman?')) {
var windowObject = gencargo.windowOpener(600,1400, "Tallyman",$(this).children().attr("url"));
gencargo.windowParentRefresh(windowObject);
}
});
gencargo对象是内容(窗口打开):
/*
* open window
*/
windowOpener : function (windowHeight, windowWidth, windowName, windowUri) {
var centerWidth = (window.screen.width - windowWidth)/2;
var centerHeight = (window.screen.height - windowHeight)/2;
newWindow = window.open(windowUri, windowName, 'resizable=0,width=' + windowWidth +
',height=' + windowHeight +
',left=' + centerWidth +
',top=' + centerHeight);
newWindow.focus();
return newWindow;
},
,也窗口关闭:
windowParentRefresh : function(object) {
$(object).bind('beforeunload', function() {
object.opener.location.reload();
});
}
关闭窗口事件不工作即。只有在FireFox,Chrome,Opera。
是的。我试过了。但它仍然不工作,即ie – Dezigo
它似乎可以在IE 9上正常工作,但IE 8(IE 8在IE 8模式下)无法正常工作。 http://jsfiddle.net/DQfMH/ –