Skip to content

Commit 59161a6

Browse files
committed
Add consistent ?mv={version} cache busting suffix to prevent browser cache issues
1 parent 174de0b commit 59161a6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/src/Revolution/modManagerController.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,10 @@ public function registerBaseScripts()
631631
}
632632

633633
$o = '';
634+
$suffix = '?mv=' . $this->_prepareVersionPostfix();
634635
// Add script tags for the required javascript
635636
foreach ($externals as $js) {
636-
$o .= '<script src="' . $js . '"></script>' . "\n";
637+
$o .= '<script src="' . $js . $suffix . '"></script>' . "\n";
637638
}
638639

639640
// Get the state and user token for adding to the init script
@@ -758,6 +759,7 @@ public function registerCssJs()
758759
$cssjs = [];
759760
if (!empty($jsToCompress)) {
760761
foreach ($jsToCompress as $scr) {
762+
$scr = strpos($scr, '?') === false ? $scr . '?mv=' . $versionPostFix : $scr . '&mv=' . $versionPostFix;
761763
$cssjs[] = '<script src="' . $scr . '"></script>';
762764
}
763765
}
@@ -768,6 +770,7 @@ public function registerCssJs()
768770
}
769771
if (!empty($cssToCompress)) {
770772
foreach ($cssToCompress as $scr) {
773+
$scr = strpos($scr, '?') === false ? $scr . '?mv=' . $versionPostFix : $scr . '&mv=' . $versionPostFix;
771774
$cssjs[] = '<link href="' . $scr . '" rel="stylesheet" type="text/css" />';
772775
}
773776
}

0 commit comments

Comments
 (0)