I want to clear cache and hard reload browser but how to do that using JS/jQuery command when the document is ready?
My reference:
I have tried below but not working except commented with this one
but it continuously reload with never stop. Why this happen? How to make it just reload 1 time only.
$(document).ready(function(){
// window.location.reload(false);
// document.location.reload(true);
// window.location.reload(true);
// window.location.href = window.location.href;
// location.reload(true); //this one
});
Updated: Googling and tried this but not working.
sessionStorage.setItem("origin", window.location.href);
$(document).ready(function(){
if(window.location.href == sessionStorage.getItem("origin")){
window.location.reload();
sessionStorage.removeItem('origin');
}
});