This function adds a "cache buster" query string to a URL to bypass the browser's caching mechanism. On successive calls, the existing query string is updated with a new value instead of a new parameter being added. 


  • URL - the URL to modify, as a string
  • HTTP method - This parameter is optional. Since POST requests aren't cached by the browser anyway, the HTTP method may be passed in as a convenience; if anything other than "GET" is specified then the original URL is returned unchanged.

Return value:

  • The URL with the added cache buster query string


var url = "";
var newUrl = pui.addUrlCacheBuster(url);
// newUrl is ""

newUrl = pui.addUrlCacheBuster(newUrl);
// newUrl is now ""
  • No labels