判断是否联网

利用navigator.onLine

if (!navigator.onLine){             
        alert("断网了");
    };

原文地址:https://www.cnblogs.com/yanze/p/6030782.html