Enhance CSS and JS injection: add cache-buster to prevent caching issues
This commit is contained in:
@@ -511,11 +511,11 @@
|
||||
const container = document.querySelector('.seasonals-container');
|
||||
container.className = `seasonals-container ${containerClass}`;
|
||||
|
||||
// Inject CSS
|
||||
// Inject CSS with cache-buster
|
||||
if (cssFile) {
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = cssFile;
|
||||
link.href = cssFile + '?v=' + new Date().getTime();
|
||||
link.setAttribute('data-seasonal', 'true');
|
||||
link.onerror = () => console.error(`[Test Site] Failed to load CSS: ${cssFile}`);
|
||||
document.head.appendChild(link);
|
||||
@@ -525,7 +525,7 @@
|
||||
if (jsFile) {
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
const response = await fetch(jsFile);
|
||||
const response = await fetch(jsFile + '?v=' + new Date().getTime());
|
||||
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||
const code = await response.text();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user