本文介绍了如何关闭谷歌浏览器中的浏览器窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何关闭谷歌浏览器中的浏览器窗口?

我尝试下面的代码,我想通知用户该应用程序仅在IE和FireFox中运行。



我收到提醒信息,但是谷歌没有关闭谷歌浏览器。





How to close a browser window in google chrome?
I tried below code where I want to notify the users that the application runs only in IE and FireFox.

I am getting the alert message but windows is not closing in google chrome.


<script language="javascript" type="text/javascript">
            window.onload = function() {
            var nAgt = navigator.userAgent;
            if((navigator.appVersion.indexOf("MSIE") != -1 || navigator.appVersion.indexOf("Trident") != -1 || navigator.appVersion.indexOf("Edge") != -1) && (navigator.appVersion.indexOf("Firefox") == -1)){

             }
             else{
                 alert("This application runs only in IE and Mozilla");
                 window.open('', '_self', '');
                 window.close();
             }

        }
    </script>

推荐答案


这篇关于如何关闭谷歌浏览器中的浏览器窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 02:08
查看更多