解决方法:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
function winClose() {
if(confirm("确定要退出吗?")){
var browserName=navigator.appName;
//火狐等
if (browserName=="Netscape"){
window.open("about:blank","_self").close()
}
//IE
if (browserName=="Microsoft Internet Explorer") {
window.close();
}
}
}
</script>
</head>
<body>
<button onclick="winClose()">close</button>
</body>
</html>