firefox浏览器不能使用window.close的解决方案


     javascript中window.close()函数用来关闭窗体,而且IE、google、firefox浏览均支持,但由于firefox浏览器dom.allow_scripts_to_close_windows参数默认值为false,故close不启作用。

    首先在firefox地址栏中输入about:config然后找到dom.allow_scripts_to_close_windows参数设置为true即可,如下图所示:

附 IE、google、firefox通用关闭窗口方法

 function closeWindow() {
           var browserName = navigator.appName;
           if (browserName == "Netscape") {
               window.open('', '_self', '');
               window.close();
           }
           else {
               if (browserName == "Microsoft Internet Explorer") {
                   window.open('', '_parent', '');
                   window.close();
               }
           }
       }


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM