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