小编Zib*_*chi的帖子

Jquery - 检查Internet连接

我想创建jquery监听器来检查互联网连接.

    function checkInternetConnection()
    {
        onConnectionClosed:function(){
            dialog.show("Connection closed please wait");
        }
        onConnectionOpened:function(){
            dialog.hide();
        }
    }
    
    $(document).ready(function(){
        checkInternetConnection();
    });
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

因此,当关闭连接时,我想向用户显示一个对话框.当连接回来时我想隐藏对话框.我怎样才能做到这一点?

javascript jquery google-chrome internet-connection

1
推荐指数
1
解决办法
1343
查看次数