From 84d09b8e0f18fbe2cc381f44c2dc7403da832856 Mon Sep 17 00:00:00 2001 From: duanyu5871 <344094952@qq.com> Date: Sun, 12 Oct 2025 13:53:39 +0000 Subject: [PATCH] beforeunload update --- data/src/emulator.js | 5 +++++ index.html | 1 + 2 files changed, 6 insertions(+) diff --git a/data/src/emulator.js b/data/src/emulator.js index ca74f56..58e70c2 100644 --- a/data/src/emulator.js +++ b/data/src/emulator.js @@ -1159,6 +1159,11 @@ class EmulatorJS { }, 0); }); this.addEventListener(window, "beforeunload", (e) => { + if (window.EJS_askBeforeUnload) { + e.preventDefault(); + e.returnValue = ''; + return + } if (!this.started) return; this.callEvent("exit"); }); diff --git a/index.html b/index.html index f6e02bd..44e5785 100644 --- a/index.html +++ b/index.html @@ -259,6 +259,7 @@ window.EJS_DEBUG_XX = enableDebug; window.EJS_disableDatabases = true; window.EJS_threads = enableThreads; + window.EJS_askBeforeUnload = false; if (browserMode) { window.EJS_browserMode = browserMode; }