如何关闭chrome中的当前窗口 [英] How to close current window in chrome
本文介绍了如何关闭chrome中的当前窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<script>
function closeCurrentWindow() {
var version=0;
if (navigator.appVersion.indexOf("MSIE")!=-1){
var temp=navigator.appVersion.split("MSIE");
version=parseFloat(temp[1]);
}
if (version>=5.5 && version<=6) {
this.focus();
self.opener = this;
self.close();
} else {
window.open('','_parent','');
window.close();
}
}
</script>
<body onload= closeCurrentWindow()>
此代码用于关闭当前窗口,但它仅适用于IE而不是Chrome和Firefox
This code is to close the current window but it is working only with IE not with Chrome and Firefox
推荐答案
试试这个:
Try this:
window.open('', '_self', '');
window.close();
点击此处查看更多信息:Chrome Issue
请参阅此处
http://codeissue.com/issues/i74ddb15295c601 / window-close-does-work-in-firefox-and-chrome [ ^ ]
这篇关于如何关闭chrome中的当前窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文