3

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.

Umair Ayub
  • 19,358
  • 14
  • 72
  • 146

1 Answers1

7

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();
Ismail RBOUH
  • 10,292
  • 2
  • 24
  • 36
  • Oh, my friend, you miss-understand the purpose ! This is not a gif/css/js file :D please read the article you have posted @CharlesAddis. USING QUERYSTRING **WILL NOT** PREVENT RESOURCES IN THE PAGE FROM BEING CACHED but JUST THE PAGE ITSELF! and THAT'S THE GOAL OF THE OP !! please remove the downvote ! – Ismail RBOUH Jul 23 '16 at 18:38