function webclose()
{
var browserName=navigator.appName;
 if (browserName=="Netscape") 
 { window.open('','_parent',''); 
 window.close(); 
 } 
 else if (browserName=="Microsoft Internet Explorer")
 { 
  window.opener=null; 
  window.open('','_self'); 
  window.close(); 
 } 
}
不提示退出直接关闭当前html页面,火狐不兼容。
在网上看到说如果使用的是firefox浏览器必须要做以下设置 
1、在地址栏输入about:config然后回车,警告确认 
2、在过滤器中输入”dom.allow_scripts_to_close_windows“,双击即可将此值设为true 有没有不设置浏览器  就可以退出   兼容火狐的方法?

解决方案 »

  1.   

    function webclose()
    {
     var browserName=navigator.appName;
     if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)
     { 
        window.open('about:blank','_self','');
        window.open('','_self','');
        top.closeWindow();
        parent.closeWindow();
     }
     else
     {
      window.opener=null;  
      window.open('','_self');  
      window.close();  
     }
    }
    我现在这样写了,虽然ie与火狐都能退出了,但是火狐退出后的页面是about:blank页面,我要求退出整个浏览器,但是如果window.open('about:blank','_self','');里面的about:blank置空,火狐无法识别,有什么方法吗?