diff --git a/web/skins/classic/js/skin.js b/web/skins/classic/js/skin.js index ba0a17e7f..9c68e81fe 100644 --- a/web/skins/classic/js/skin.js +++ b/web/skins/classic/js/skin.js @@ -2088,22 +2088,22 @@ function initPageGeneral() { }, 200); // https://web.dev/articles/bfcache Firefox has a peculiar behavior of caching the previous page. + // The problem also occurs on some Linux (Chromium) and Android (Chrome) devices. window.addEventListener('pageshow', (event) => { if (event.persisted) { // Do any checks and updates to the page - if (mainContentJ[0].clientHeight < 1) { - window.location.reload( true ); - } + window.location.reload( true ); } }); - window.addEventListener('beforeunload', function addListenerGlobalBeforeunload(event) { + function addListenerGlobalBeforeunload(event) { + //window.removeEventListener('beforeunload', addListenerGlobalBeforeunload); //event.preventDefault(); if (navbar_type == 'left') { closeMbExtruder(updateCookie = true); } - if (mainContentJ) { + if (mainContent) { if (mainContentJ.css('display') == 'flex') { // If flex-grow is set to a value > 0 then "height" will be ignored! mainContentJ.css({flex: "0 1 auto"}); @@ -2112,14 +2112,13 @@ function initPageGeneral() { mainContentJ.css({display: "none"}); } else { mainContentJ.animate({height: 0}, 300, function rollupBeforeunloadPage() { - const btnCollapse = $j('body').find('#btn-collapse'); - if (btnCollapse.length) btnCollapse.css({display: "none"}); mainContentJ.css({display: "none"}); }); } } //event.returnValue = ''; - }); + } + window.addEventListener('beforeunload', addListenerGlobalBeforeunload); document.querySelectorAll('[id ^= "controlMute"]').forEach(function(el) { el.addEventListener("click", function clickControlMute(event) {