From 1fddcda12fd10d6cc6bf655d232af05304ec94ef Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 6 Jan 2026 14:32:37 +0100 Subject: [PATCH] Message on reload to hopefully stop the user. --- assets/game1.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/assets/game1.js b/assets/game1.js index e657c69..c6d93f8 100644 --- a/assets/game1.js +++ b/assets/game1.js @@ -60,6 +60,15 @@ document.addEventListener('DOMContentLoaded', async () => { // Look for config injected by Twig in the page const cfgEl = document.getElementById('mercure-config'); + + // Prevent/warn on page reload + window.addEventListener('beforeunload', (event) => { + // Standard way to trigger the browser's confirmation dialog + event.preventDefault(); + // Included for compatibility with older browsers + event.returnValue = ''; + }); + if (!cfgEl) { console.warn('[Mercure][game1] #mercure-config element not found on page'); return;