.
3ss.cn

javascript中window.close怎么别提示弹窗

在javascript中,可以在window.close前添加“window.opener=null;window.open('','_self');”语句设置不提示弹窗。window.opener引用的是window.open打开的页面。

本教程操作环境:windows7系统、javascript1.8.5版、Dell G3电脑。

在window.close();?前加上

window.opener = null;
window.open('', '_self');

就不会提示’是否要关闭本窗口’了!

所以打开新的网页并且关闭当前页面的方法是:

window.open(newurl);
window.opener = null;
window.open('', '_self');
window.close();

其中newurl为要转向页面的URl。

赞(0)
未经允许不得转载:互联学术 » javascript中window.close怎么别提示弹窗

评论 抢沙发