chrome close js 关闭当前页面

Chrome浏览器如何调用js关闭当前页面

Ext.Ajax.request({
        url: "Logout.aspx",
        params: {
            tag: "logout"
        },
        success: function () {
            var browserName = navigator.appName;
            if (browserName == "Netscape") {
                window.location.href = "about:blank";                    //关键是这句话
                window.close();
            } else if (browserName == "Microsoft Internet Explorer") {
                window.opener = null;
                window.close();
            }
        }
    });

在Chrome中,必须指定 window.location.href = "about:blank"; 

然后才调用close()方法.否则浏览器会提示:

VM408:1 Scripts may close only the windows that were opened by it.

你可能感兴趣的:(extjs,chrome,close,js)