pui.addUrlCacheBuster()



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. 

Parameters:

  • 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

Example:

var url = "http://www.profoundlogic.com:8080/profoundui/proddata/images/blocks.jpg"; var newUrl = pui.addUrlCacheBuster(url); // newUrl is "http://www.profoundlogic.com:8080/profoundui/proddata/images/blocks.jpg?r=1577131915250" newUrl = pui.addUrlCacheBuster(newUrl); // newUrl is now "http://www.profoundlogic.com:8080/profoundui/proddata/images/blocks.jpg?r=1577132051916"