From b12d13bae4418b83013ff0a3ba5b835dcd1f8073 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Wed, 30 Oct 2024 16:41:23 +0100 Subject: [PATCH] Use legacy JS instead of event handlers Legacy browsers and 'embedded' browsers like the one in Office do not always support event handlers --- src/main/resources/public/post.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/resources/public/post.js b/src/main/resources/public/post.js index a68b91d..6e8d028 100644 --- a/src/main/resources/public/post.js +++ b/src/main/resources/public/post.js @@ -1,3 +1,6 @@ -document.addEventListener("DOMContentLoaded", function () { +window.handleState = function handleState() { + if (document.readyState === 'interactive' || document.readyState === "complete") { document.forms[0].submit(); -}); + } +}; +document.onreadystatechange = window.handleState;