如何自动关闭chrome [英] how to close chrome automaticaly

查看:104
本文介绍了如何自动关闭chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我写的是自动代码的javascript但脚本不支持chrome.Please帮我解决这个问题



Hi,
I am Write javascript for windows automaticaly code but script not supported chrome.Please help me to solve this problem

function SetupWindowClose()
{
window.setTimeout("window.close()",1000);
}

推荐答案

如果是chrome,只有在脚本打开的情况下才能关闭窗口。

你可以试试这个。

In case of chrome , you can only close the window if it is opened by script.
You can try this.
window.open('', '_self', ''); 
window.close();


这是一个可以使用的示例google chrome:



Here is a sample that will work in google chrome:

<html>
    <body>
        <script type="text/javascript">
            window.open('', '_self', ''); 
            function SetupWindowClose()
            {
                //alert("Set it!");
                window.setTimeout("window.close()", 3000);
            }
            //alert("Before execute!");
            SetupWindowClose();
        </script>
        <h1>Hello goodbye!</h1>
    </body>
</html>





问候,



- Manfred


你可以试试这个: -



You can try this:-

function SetupWindowClose()
{
      window.open('javascript:window.open("", "_self",  "");window.close();', '_self');
}











OR

function SetupWindowClose()
{
    close();
}


这篇关于如何自动关闭chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆