IE7/IE6下关闭窗口不弹出提示窗口方法

IE7/IE6下关闭窗口不弹出提示窗口方法
在IE7 下, 用window.close() 关闭一个窗口, IE7 总是会弹出一个提示, 问是否关闭这个窗口, 烦都烦死了, 可以让它不弹出提示的代码如下:
经试验:IE6下同样没问题。


经试验:IE6下同样没问题。

window.opener=null;//如果后面需要用openner,这一行可以去掉
window.open('','_top');
window.top.close();


<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'test.jsp' starting page</title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">   
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script language="javascript">
function init(){
window.opener=null;
window.open('','_top');
window.top.close();    //关闭老页面时 不用 确认关闭
window.open ('http://www.baidu.com','_blank','top=0,left=0,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,fullscreen=yes');
}
</script>

</head>

<body onload="init()">
<input type="button" value="baidu" onclick="init()">
    
</body>
</html>

你可能感兴趣的:(java,html,jsp)