Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make window.location.href load page from Server instead from browser cache

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.

like image 825
Umair Ayub Avatar asked Sep 27 '26 09:09

Umair Ayub


1 Answers

You can use this:

window.location.href = "http://www.mywebsite.com/products?t="+ (new Date().getTime());

Or:

window.location.href = "http://www.mywebsite.com/products?t="+ Math.random();
like image 194
Ismail RBOUH Avatar answered Sep 30 '26 00:09

Ismail RBOUH



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!