I am making a redirect using window.location.href
.
But what it does, it simply fetches old page (not showing the newly added item) that was previously in borwser's cache.
I want it to fetch every think from server, just like we use true
parameter in document.location.reload(true)
to load a fresh copy of page from server.
I am making a redirect using window.location.href
.
But what it does, it simply fetches old page (not showing the newly added item) that was previously in borwser's cache.
I want it to fetch every think from server, just like we use true
parameter in document.location.reload(true)
to load a fresh copy of page from server.
- can you show your code here? – Syed Aqeel Commented Jul 23, 2016 at 18:21
-
its simply
window.location.href = "http://www.mywebsite./products"
– Umair Ayub Commented Jul 23, 2016 at 18:22 -
if you think that it loads cached pages instead of new then you should try in
private browsing
to see the new result. other condition I can't examine what are you asking about – Syed Aqeel Commented Jul 23, 2016 at 18:26
2 Answers
Reset to default 7You can use this:
window.location.href = "http://www.mywebsite./products?t="+ (new Date().getTime());
Or:
window.location.href = "http://www.mywebsite./products?t="+ Math.random();
You can use this for any websites:
window.location.href = window.location.href.split('?')[0] + '?cacheBuster=' + new Date().getTime();