The URL is timestamped to avoid caching problems when requesting the current path again
1. Explanation: adding a timestamp to the URL will ensure that every request initiated is different from the previous request, so as to avoid the browser caching the URL.
2. Introduce the following code in HTML head:
<script type="text/javascript">
var timeTag = sessionStorage.getItem("time") || null;
if(!timeTag) { //Determine if there is a timestamp in sessionStorage, if not, add a timestamp to the url and save it
var arr = location.href.split('#/');
var timestamp = new Date().getTime(); //get the timestamp of the entry item
if( location.href.indexOf('?time=') ! = -1 ){ //judge sessionStorage did not save the timestamp, but the url has a timestamp case, you need to convert the url's timestamp to the latest, to avoid the cache of the current path again request
var arr2 = location.href.split('?time=');
window.location.href = arr2[0] + '?time=' + timestamp + '#/' +arr[1];
}else { //judge sessionStorage did not save the timestamp, and the url does not have a timestamp case, timestamp added to the url
window.location.href = arr[0] + '?time=' + timestamp + '#/' +arr[1];
}
sessionStorage.setItem("time",timestamp) // store the timestamp of the current entry item
}
</script>
Read More:
- Springboot configuration project access path URL root path
- The page you are requesting cannot be served because of the extension configuration
- Vivado Error: [Chipscope 16-302]Could not generate core for dbg_hub.Aborting IP Generate operaion.The current Vivado temporary directory path.
- [Solved] Canal 1.1.5 Startup Error: caching_sha2_password Auth failed
- [Solved] CMake Error: The current CMakeCache.txt directory is different than xxx
- How to Avoid Windows Error in Gitbook Serve
- [Solved] Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
- PgSQL associated tables perform update to avoid using in query SQL
- [Solved] MindSpore Error: task_fail_info or current_graph_ is nullptr
- [Solved] eggjs Error: Warning: Current Server Discovery and Monitoring engine is deprecated, and will be rem…
- [Solved] PostgreSQL Error: ERROR: CURRENT TRANSACTION IS ABORTED, COMMANDS IGNORED UNTIL END OF TRANSA
- [Solved] MongoDB Error: FaileError: dToParse: Password must be URL Encoded for mongodb:// URL:
- [Solved] LaTeX Error: \Url Error ->\url used in a moving argument.
- [Solved] spring boot security Start Error: ‘login.html?error‘ is not a valid redirect URL
- How to Solve Error: avoided redundant navigation to current location: “index/user”
- Current request is not a multipart request [How to Solve]
- [Solved] idea git Update failed unable to access ‘httpxxx‘ The requested URL returned error: 500
- [step on the pit] idea submits the code to GitHub and prompts 403 — the requested URL returned error: 403
- [Solved] LaTex Error: Critical Package ctex Error: CTeX fontset `fandol‘ is unavailable in current(ctex) mode. }
- Debug Error: Failed to fetch current robot state [How to Solve]