您好,欢迎来到爱玩科技网。
搜索
您的当前位置:首页js实现关闭网页的代码

js实现关闭网页的代码

来源:爱玩科技网


本文主要和大家分享js实现关闭网页的代码,希望能帮助到大家。

<button onclick="window.opener=null;window.open('', '_self');window.close()">关闭</button>

很简单的关闭本页面的方法,没有其他额外的提示:

window.opener=null; //返回对创建该窗口的 Window 对象的引用。window.open('', '_self'); //方法用于打开一个新的浏览器窗口或查找一个已命名的窗口。window.close() //用于关闭浏览器窗口。

_self是在本页面打开一个新页面的意思,可以参考看target的四种属性_prarent,_blank,_selft,_top

<button onclick="window.opener=null;window.open('', '_self');window.close()">关闭</button>

很简单的关闭本页面的方法,没有其他额外的提示:

window.opener=null; //返回对创建该窗口的 Window 对象的引用。window.open('', '_self'); //方法用于打开一个新的浏览器窗口或查找一个已命名的窗口。window.close() //用于关闭浏览器窗口。

_self是在本页面打开一个新页面的意思,可以参考看target的四种属性_prarent,_blank,_selft,_top

Copyright © 2019- aiwanbo.com 版权所有 赣ICP备2024042808号-3

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务