Skip to content Skip to sidebar Skip to footer

How Do I Attach Or Update A Timestamp Querystring Parameter

I want to attach a timestamp to my querystring in order to ensure that the browser bypasses its cache when I refresh the page via javascript. I need to account for an existing que

Solution 1:

For manipulating the query string parameters I recommend you this plugin:

It's very easy to use:

var timestamp = $.query.get('ts'); // get a valuewindow.location = $.query.set('ts', newValue); // set a value and navigate

Solution 2:

var newLocation = window.location.href.replace(/\?.*(ts=\d*)/, "ts=" + newDate().valueOf());

Post a Comment for "How Do I Attach Or Update A Timestamp Querystring Parameter"