javascriptjquerycodeigniterhttp-redirect

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.


Solution

  • 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();