diff --git a/html/index.js b/html/index.js
index 5b51ada..9d1b6a4 100644
--- a/html/index.js
+++ b/html/index.js
@@ -593,11 +593,28 @@ function printResult() {
wprint.document.title = 'pyRCV2 Report';
// Add stylesheets
+ let numToLoad = 0;
+ let numLoaded = 0;
+
+ function onLoadStylesheet() {
+ numLoaded++;
+ if (numLoaded == numToLoad) {
+ wprint.print();
+ }
+ }
+
for (let elCSSBase of document.querySelectorAll('head link')) {
+ numToLoad++;
let elCSS = wprint.document.createElement('link');
elCSS.rel = elCSSBase.rel;
elCSS.type = elCSSBase.type;
- elCSS.href = elCSSBase.href;
+ if (elCSSBase.href.endsWith('?v=GITVERSION')) {
+ elCSS.href = elCSSBase.href.replace('?v=GITVERSION', '?v=' + Math.random());
+ } else {
+ elCSS.href = elCSSBase.href;
+ }
+
+ elCSS.onload = onLoadStylesheet;
wprint.document.head.appendChild(elCSS);
}
@@ -702,6 +719,4 @@ function printResult() {
divResultLogs2 = wprint.document.createElement('div');
divResultLogs2.innerHTML = divResultLogs1.innerHTML;
elContainer.appendChild(divResultLogs2);
-
- wprint.print();
}