2

I am making a redirect using window.location.href to Listing view after an Item is added to DB after successful CREATE operation.

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
  • 15,903
  • 12
  • 65
  • 138

1 Answers1

5

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
  • 9,836
  • 2
  • 22
  • 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