mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-11-04 21:24:00 +01:00
Using cache for downloaded files
This commit is contained in:
parent
35fbb41638
commit
a080913d85
@ -2,12 +2,10 @@ async function getTextFromFileUrlAsync(url) {
|
|||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var req = new XMLHttpRequest();
|
var req = new XMLHttpRequest();
|
||||||
req.open("GET",url, true);
|
req.open("GET",url, true);
|
||||||
for (const item of ["no-cache","no-store","must-revalidate"]) {
|
req.setRequestHeader("Cache-Control", "max-age=0")
|
||||||
req.setRequestHeader("Cache-Control",item)
|
|
||||||
}
|
|
||||||
req.onreadystatechange = function() {
|
req.onreadystatechange = function() {
|
||||||
if (req.readyState == 4) {
|
if (req.readyState == 4) {
|
||||||
if (req.status == 200) {//when a good response is given do this
|
if (req.status == 200 || req.status==304) {//when a good response is given do this
|
||||||
var text = req.responseText;
|
var text = req.responseText;
|
||||||
resolve(text);
|
resolve(text);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user