From 6f543e860fb5216f0208f7737c78357ef929414d Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 4 Apr 2025 15:58:06 +0000 Subject: [PATCH] #3809 Add beforeunload event listener to prompt user when chat is saving --- public/script.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/script.js b/public/script.js index 1566a83cb..b57dad454 100644 --- a/public/script.js +++ b/public/script.js @@ -12209,4 +12209,11 @@ jQuery(async function () { }); initCustomSelectedSamplers(); + + window.addEventListener('beforeunload', (e) => { + if (isChatSaving) { + e.preventDefault(); + e.returnValue = true; + } + }); });