diff --git a/app/ui.js b/app/ui.js index 84e1585a..e5f18d20 100644 --- a/app/ui.js +++ b/app/ui.js @@ -166,6 +166,12 @@ const UI = { } }); + window.addEventListener("beforeunload", (e) => { + if (UI.rfb) { + UI.disconnect(); + } + }); + return Promise.resolve(UI.rfb); },