Fix: With "bfcache," always refresh the page without analyzing the content height. (skin.js)

Because in addition to Firefox, the problem occurs on some Linux (Chromium) and Android (Chrome) devices.
This commit is contained in:
IgorA100
2025-12-11 10:24:49 +03:00
committed by GitHub
parent f0daaaba5f
commit f2cf0dd962

View File

@@ -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) {