Skip to content

Commit

Permalink
Implement front-end strategy to prevent caching
Browse files Browse the repository at this point in the history
By adding a random string to the path of the js file every time, we make sure to never hit the browser cache.
  • Loading branch information
Moustachauve committed Nov 9, 2023
1 parent 1dab26b commit 51dfa9a
Show file tree
Hide file tree
Showing 16 changed files with 5,297 additions and 5,238 deletions.
2 changes: 1 addition & 1 deletion usermods/RelayBlinds/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
strA = "";
function send()
{
nocache = "&nocache=" + Math.random() * 1000000;
nocache = "&nocache=" + Date.now();
var request = new XMLHttpRequest();
// send HTTP request
request.open("GET", "win/" + strA +nocache, true);
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/settings.htm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
function loadJS(FILE_URL, async = true) {
let scE = d.createElement("script");
scE.setAttribute("src", FILE_URL);
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
scE.setAttribute("type", "text/javascript");
scE.setAttribute("async", async);
d.body.appendChild(scE);
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/settings_2D.htm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
function loadJS(FILE_URL, async = true) {
let scE = d.createElement("script");
scE.setAttribute("src", FILE_URL);
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
scE.setAttribute("type", "text/javascript");
scE.setAttribute("async", async);
d.body.appendChild(scE);
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/settings_dmx.htm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
function loadJS(FILE_URL, async = true) {
let scE = d.createElement("script");
scE.setAttribute("src", FILE_URL);
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
scE.setAttribute("type", "text/javascript");
scE.setAttribute("async", async);
d.body.appendChild(scE);
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/settings_leds.htm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
function loadJS(FILE_URL, async = true) {
let scE = d.createElement("script");
scE.setAttribute("src", FILE_URL);
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
scE.setAttribute("type", "text/javascript");
scE.setAttribute("async", async);
d.body.appendChild(scE);
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/settings_sec.htm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
function loadJS(FILE_URL, async = true) {
let scE = d.createElement("script");
scE.setAttribute("src", FILE_URL);
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
scE.setAttribute("type", "text/javascript");
scE.setAttribute("async", async);
d.body.appendChild(scE);
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/settings_sync.htm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
function loadJS(FILE_URL, async = true) {
let scE = d.createElement("script");
scE.setAttribute("src", FILE_URL);
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
scE.setAttribute("type", "text/javascript");
scE.setAttribute("async", async);
d.body.appendChild(scE);
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/settings_time.htm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
function loadJS(FILE_URL, async = true) {
let scE = d.createElement("script");
scE.setAttribute("src", FILE_URL);
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
scE.setAttribute("type", "text/javascript");
scE.setAttribute("async", async);
d.body.appendChild(scE);
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/settings_ui.htm
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
function loadJS(FILE_URL, async = true) {
let scE = d.createElement("script");
scE.setAttribute("src", FILE_URL);
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
scE.setAttribute("type", "text/javascript");
scE.setAttribute("async", async);
d.body.appendChild(scE);
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/settings_um.htm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
function loadJS(FILE_URL, async = true) {
let scE = d.createElement("script");
scE.setAttribute("src", FILE_URL);
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
scE.setAttribute("type", "text/javascript");
scE.setAttribute("async", async);
d.body.appendChild(scE);
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/settings_wifi.htm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
function loadJS(FILE_URL, async = true) {
let scE = cE("script");
scE.setAttribute("src", FILE_URL);
scE.setAttribute("src", FILE_URL + "&c=" + Date.now());
scE.setAttribute("type", "text/javascript");
scE.setAttribute("async", async);
d.body.appendChild(scE);
Expand Down
1,252 changes: 626 additions & 626 deletions wled00/html_other.h

Large diffs are not rendered by default.

998 changes: 524 additions & 474 deletions wled00/html_pixart.h

Large diffs are not rendered by default.

4,026 changes: 2,018 additions & 2,008 deletions wled00/html_settings.h

Large diffs are not rendered by default.

2,262 changes: 1,131 additions & 1,131 deletions wled00/html_simple.h

Large diffs are not rendered by default.

1,975 changes: 987 additions & 988 deletions wled00/html_ui.h

Large diffs are not rendered by default.

0 comments on commit 51dfa9a

Please sign in to comment.