electron-h5-网络状态检测
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <h1>断网检测</h1> </body> <script> //online offline window.addEventListener('online',(e)=>{ alert('网来了') }) window.addEventListener('offline',(e)=>{ alert('望断了秋水') }) </script> </html>