'clear browsing cache - basic html css js website
I've created a simple HTML, SASS, JS website and each time im uploading new files, to actually see the changes appear on the website I need to clear my browsing data.
is there anyway to address it via vanilla js headers, or a button on the website to clear cache?
Solution 1:[1]
You can create a button that deletes the cache for that page like this :
<button>Clear cache </button>
let btn = document.querySelector("button");
btn.addEventListener("click",()=>{
window.location.reload(true);
window.location.reload(); // few browsers don't require for a parameter to be passed
})
To know more about window.location.reload(true)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
