window.open的相关操作
1、Open打开窗口,若Open被禁用,可以弹出提示:
代码
var win = window.open("test.aspx", "openwin", "");
var i = 0;
try {
while (win.document.body == null || typeof (win.document.body) == undefined) {//解决win.document.body延时访问到错误
i++;
}
}
catch (e) { }
if (win == null) {
alert('请设置允许本站点弹出页');
}
var i = 0;
try {
while (win.document.body == null || typeof (win.document.body) == undefined) {//解决win.document.body延时访问到错误
i++;
}
}
catch (e) { }
if (win == null) {
alert('请设置允许本站点弹出页');
}
2、Open打开的窗口,关闭时刷新父窗口
window.opener.location.reload();
window.opener = null;
window.open('', '_self');
window.close();
window.opener = null;
window.open('', '_self');
window.close();