window.close 在firefox无效问题

   window.close 在firefox无效,有解决方案是改firefox设置

     Firefox地址栏里输入 about:config
    在配置列表中找到 dom.allow_scripts_to_close_windows
    点右键的选切换把上面的false修改为true即可。

 这种方法要求每个用户都这样来一遍,不太可能。。。

解决方法:

 var rand = parseInt(Math.random() * 100 + 1);
        var rv = window.showModalDialog('Redirect.htm?ID=' + ID + '&rand=' + rand, '', "dialogWidth=680px;dialogHeight=580px;help:no;");

Redirect.htm:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
 <head>
  <title>按模板导出Excel</title>
  <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
  <meta name="ProgId" content="VisualStudio.HTML">
  <meta name="Originator" content="Microsoft Visual Studio .NET 7.1">
  
  <meta http-equiv="Pragma" content="no-cache">
  <meta http-equiv="no-cache">
  <meta http-equiv="Expires" content="-1">
  <meta http-equiv="Cache-Control" content="no-cache">
  
  <base target="_self" />
  
  <script language="javascript">
      function Load() {
          window.Code.location.href = 'DepartmentEdit.aspx' + window.location.search;
      }
  </script>
 </head>
 <body topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0 onload="Load()">
  <table width=100% height=100% border=0 cellpadding=0 cellspacing=0>
   <tr>
    <td>
     <iframe id=Code name=Code frameborder=0 height=100% width=100% scrolling="yes"></iframe>
    </td>
   </tr>
  </table>
 </body>
</html>


 

DepartmentEdit.aspx

parent.window.close();

问题解决

原文地址:https://www.cnblogs.com/stanley107/p/2548993.html