Reputation: 26223
I can use location.reload(true)
to refresh the page and refetch the page. I want to redirect the user to a new URL and clear the cache.
More specifically, I have a "Clear all cookies" button that redirects the user to the homepage after being clicked. I want the homepage to be refreshed.
Upvotes: 4
Views: 15672
Reputation: 2747
Do something like:
var loc = window.location.href; // or a new URL
window.location.href = loc + '?n=' + new Date().getTime(); // random number
EDIT: The only option for reloading static resources (see comment below) would be to append the random number to their URLs server-side by listening for the 'n' query string.
Upvotes: 12