Skip to content

Commit 51dfa9a

Browse files
committed
Implement front-end strategy to prevent caching
By adding a random string to the path of the js file every time, we make sure to never hit the browser cache.
1 parent 1dab26b commit 51dfa9a

16 files changed

+5297
-5238
lines changed

usermods/RelayBlinds/index.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
strA = "";
88
function send()
99
{
10-
nocache = "&nocache=" + Math.random() * 1000000;
10+
nocache = "&nocache=" + Date.now();
1111
var request = new XMLHttpRequest();
1212
// send HTTP request
1313
request.open("GET", "win/" + strA +nocache, true);

wled00/data/settings.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
1212
function loadJS(FILE_URL, async = true) {
1313
let scE = d.createElement("script");
14-
scE.setAttribute("src", FILE_URL);
14+
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
1515
scE.setAttribute("type", "text/javascript");
1616
scE.setAttribute("async", async);
1717
d.body.appendChild(scE);

wled00/data/settings_2D.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
1717
function loadJS(FILE_URL, async = true) {
1818
let scE = d.createElement("script");
19-
scE.setAttribute("src", FILE_URL);
19+
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
2020
scE.setAttribute("type", "text/javascript");
2121
scE.setAttribute("async", async);
2222
d.body.appendChild(scE);

wled00/data/settings_dmx.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
3838
function loadJS(FILE_URL, async = true) {
3939
let scE = d.createElement("script");
40-
scE.setAttribute("src", FILE_URL);
40+
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
4141
scE.setAttribute("type", "text/javascript");
4242
scE.setAttribute("async", async);
4343
d.body.appendChild(scE);

wled00/data/settings_leds.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
2020
function loadJS(FILE_URL, async = true) {
2121
let scE = d.createElement("script");
22-
scE.setAttribute("src", FILE_URL);
22+
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
2323
scE.setAttribute("type", "text/javascript");
2424
scE.setAttribute("async", async);
2525
d.body.appendChild(scE);

wled00/data/settings_sec.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
1616
function loadJS(FILE_URL, async = true) {
1717
let scE = d.createElement("script");
18-
scE.setAttribute("src", FILE_URL);
18+
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
1919
scE.setAttribute("type", "text/javascript");
2020
scE.setAttribute("async", async);
2121
d.body.appendChild(scE);

wled00/data/settings_sync.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
1616
function loadJS(FILE_URL, async = true) {
1717
let scE = d.createElement("script");
18-
scE.setAttribute("src", FILE_URL);
18+
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
1919
scE.setAttribute("type", "text/javascript");
2020
scE.setAttribute("async", async);
2121
d.body.appendChild(scE);

wled00/data/settings_time.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
1717
function loadJS(FILE_URL, async = true) {
1818
let scE = d.createElement("script");
19-
scE.setAttribute("src", FILE_URL);
19+
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
2020
scE.setAttribute("type", "text/javascript");
2121
scE.setAttribute("async", async);
2222
d.body.appendChild(scE);

wled00/data/settings_ui.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
167167
function loadJS(FILE_URL, async = true) {
168168
let scE = d.createElement("script");
169-
scE.setAttribute("src", FILE_URL);
169+
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
170170
scE.setAttribute("type", "text/javascript");
171171
scE.setAttribute("async", async);
172172
d.body.appendChild(scE);

wled00/data/settings_um.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
2424
function loadJS(FILE_URL, async = true) {
2525
let scE = d.createElement("script");
26-
scE.setAttribute("src", FILE_URL);
26+
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
2727
scE.setAttribute("type", "text/javascript");
2828
scE.setAttribute("async", async);
2929
d.body.appendChild(scE);

0 commit comments

Comments
 (0)