I have deployed the latest version of my website, but until I do Clear cache and reload, My website is not updating automatically. How can I do this in the code using JavaScript? Thanks in advance.
I have tried using
window.location.reload()
location.reload()
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />
But nothing were working as expected.
In my Angular application, I had the same issue.
My solution was to clear the cache memory and also update the HTML page content.
Here is an example:
setTimeout(() => {
const content = await
window.fetch(location.host).then(response =>{
htmlContent = response.text();
location.reload(true)})
}, 1000)
I hope this help 🙏