In my web application I am setting window.location
to navigate to a different page, but for some reason Firefox shows an old version of that page.
Usin
You have to validate if there is any existing query parameter in the url. If any query parameter exist, you should append the timestamp using "&". I have written a quick snippet that might be of your help.
window.newLocation = function( location ) {
var newLocation = ( typeof location === "string" ) ? location : window.location.href,
appendType = ( newLocation.indexOf("?") < 0 ) ? "?" : "&";
window.location = newLocation + appendType + "_t=" + (new Date()).getTime();
}
Usage:
newLocation("index.html") or window.newLocation("index.html")
// opens "index.html?_t="
newLocation("index.html?existingQuery=true") or window.newLocation("index.html?existingQuery=true")
// opens "index.html?existingQuery=true&_t=
You could further modify the snippet to remove exiting timestamp in the query parameter to avoid duplication