Skip to content

Commit

Permalink
add cache busting to preloads phetsims/chipper#755
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jul 12, 2019
1 parent 132bdcf commit 4c78e15
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fraction-comparison_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="phet-sim-level" content="development">

<title>fraction-comparison</title>
</head>

Expand All @@ -29,6 +29,10 @@
const brandMatch = location.search.match( /brand=([^&]+)/ );
const brand = brandMatch ? decodeURIComponent( brandMatch[ 1 ] ) : 'adapted-from-phet';

// matches "cacheBust" at the start of the string, as well as directly after "?" or "&"
const cacheBust = /(^|\?|&)cacheBust/.test( location.search );
const queryAppend = cacheBust ? `?bust=${Date.now()}` : '';

// Preloads, with more included for phet-io brand
let preloads = [
'../joist/js/splash.js',
Expand Down Expand Up @@ -68,7 +72,7 @@
script.setAttribute( 'data-main', main );
}
script.type = 'text/javascript';
script.src = preloadURL;
script.src = preloadURL + queryAppend;
script.async = false;
document.head.appendChild( script );
};
Expand Down

0 comments on commit 4c78e15

Please sign in to comment.