与
ESC
输入关键词搜索文章

火狐 IE下关闭网页window.close的javascript代码

全文约 68 字预计阅读 1 分钟

解决window.close在火狐下不兼容问题

<script type="text/javascript"> function CloseWebPage() { if (navigator.userAgent.indexOf("MSIE") > 0) { if (navigator.userAgent.indexOf("MSIE 6.0") > 0) { window.opener = null; window.close(); } else { window.open('', '_top'); window.top.close(); } } else if (navigator.userAgent.indexOf("Firefox") > 0) { window.location.href = 'about:blank '; //window.history.go(-2); } else { window.opener = null; window.open('', '_self', ''); window.close(); } } </script> <a href="javascript:CloseWebPage();" >关闭</a>  
火狐 IE下关闭网页window.close的javascript代码
分享

发表评论

评论 0 条

暂无评论,来说点什么吧。