default.js: add parseUrl
Users were seeing outdated content due to browser caching. To resolve this issue, a unique random value is now added to the end of each URL every time the page is loaded, forcing the browser to retrieve the latest version of the page from the server. By implementing this solution, users will be able to see the most recent content without any delay caused by outdated cache files.
This commit is contained in:
@@ -78,14 +78,28 @@ function contains(s,t){
|
||||
}
|
||||
|
||||
function updateContainer(id, url, callback){
|
||||
//alert(id+":"+url);
|
||||
if (id==null) return;
|
||||
if ($("#"+id).length==0) return;
|
||||
url = parseUrl(url);
|
||||
$("#"+id).load(url, callback);
|
||||
}
|
||||
|
||||
function load(url){
|
||||
window.location=url;
|
||||
window.location = parseUrl(url);
|
||||
}
|
||||
|
||||
function parseUrl(uri){
|
||||
if (uri.startsWith("/")) {
|
||||
uri = window.location.origin + uri;
|
||||
} else if (!uri.startsWith("http")) {
|
||||
var path = window.location.pathname.replace(/\/$/, "");
|
||||
path = path.split("/");
|
||||
path.pop();
|
||||
uri = window.location.origin + path.join("/") + "/" + uri;
|
||||
}
|
||||
var url = new URL(uri);
|
||||
url.searchParams.append("_", Date.now());
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
function postContainer(url, parameters, callback){
|
||||
|
||||
@@ -83,6 +83,8 @@ function updateEventSelection(resultElemId){
|
||||
}
|
||||
|
||||
var elem=$("#selectEvent").parent();
|
||||
url = parseUrl(url);
|
||||
console.log(url);
|
||||
$(elem).load(url);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,9 @@ function updateSeriesSelection(resultElemId){
|
||||
url+="&selectProjectStudio=1";
|
||||
}
|
||||
|
||||
url = parseUrl(url);
|
||||
var elem=$("#selectSeries").parent();
|
||||
console.log(url);
|
||||
$(elem).load(url);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user