From 3b2fb607a3e59e062b3e20fd52d2292de70d60a6 Mon Sep 17 00:00:00 2001 From: srcrs Date: Fri, 19 Apr 2024 04:27:29 +0800 Subject: [PATCH] close mobile reload --- globals/static/index.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/globals/static/index.html b/globals/static/index.html index c817a33..8fd5f25 100644 --- a/globals/static/index.html +++ b/globals/static/index.html @@ -180,7 +180,11 @@ } socket.onclose = event => { console.log("WebSocket closed. Reconnecting..."); - setInterval(reloadHtml, 3000); + // 使用媒体查询判断设备类型 + const isMobile = window.matchMedia('(max-width: 767px)').matches; + if (!isMobile) { + setInterval(reloadHtml, 3000); + } }; // Send heartbeat message every 120 seconds const sendHeartbeat = () => {