- forced refresh -> css reload (in comment)
This commit is contained in:
Hyojin Ahn 2025-11-25 14:15:24 -05:00
parent ec0fc7a487
commit 90b20c8dac
1 changed files with 33 additions and 24 deletions

View File

@ -87,9 +87,9 @@
?> ?>
<link href="assets/css/mapMAPCSS.css" rel="stylesheet" type="text/css" > <link href="/assets/css/mapMAPCSS.css" rel="stylesheet" type="text/css" >
<!-- New2 --> <!-- New2 -->
<link href="assets/css/leftside-modal.css" rel="stylesheet"> <link href="/assets/css/leftside-modal.css" rel="stylesheet">
<!-- New2 --> <!-- New2 -->
<!--script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script--> <!--script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script-->
@ -2510,31 +2510,40 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
async function forceRefresh() { async function forceRefresh() {
const cssFiles = [
'assets/css/mapMAPCSS.css',
'assets/css/main.css',
'assets/css/leftside-modal.css'
];
// CSS 강제 새로고침
cssFiles.forEach(file => {
const link = document.querySelector(`link[href^="${file}"]`);
if (link) {
const href = link.href.split('?')[0];
link.href = href + '?view=map&_=' + new Date().getTime();
}
});
// 브라우저 캐시 삭제
if ('caches' in window) { if ('caches' in window) {
const keys = await caches.keys(); const keys = await caches.keys();
await Promise.all(keys.map(key => caches.delete(key))); await Promise.all(keys.map(key => caches.delete(key)));
} }
window.location.reload();
/*
const cssFiles = [
'mapMAPCSS.css',
'main.css',
'leftside-modal.css'
];
// 페이지 새로고침 cssFiles.forEach(file => {
const url = new URL(window.location.href); const oldLink = Array.from(document.querySelectorAll('link[rel="stylesheet"]'))
url.searchParams.set('view', 'map'); // view=map 유지 .find(l => l.href.endsWith(file));
window.location.href = url.toString(); if (oldLink) {
const newLink = oldLink.cloneNode();
newLink.href = oldLink.href.split('?')[0] + '?view=map&_=' + new Date().getTime();
oldLink.parentNode.replaceChild(newLink, oldLink);
console.log(`CSS replaced: ${newLink.href}`);
} else {
console.warn(`CSS not found: ${file}`);
}
});
if ('caches' in window) {
const keys = await caches.keys();
console.log('Cache keys found:', keys);
await Promise.all(keys.map(key => caches.delete(key)));
console.log('Caches cleared');
}
console.log('CSS force refresh completed without page reload');
*/
} }
$('.point-overlay').on( $('.point-overlay').on(