All Docs | Index

Cache Reload plugin API

The cache reload plugin forces the browser to update its cached copy of boomerang. Details are on the lognormal blog here and here.

Configuration

The Cache Reload plugin's configuration is under the CACHE_RELOAD namespace. The full configuration object is described in Howto #6 — Configuring boomerang.

url
[required] By default, this is set to the empty string, which has the effect of disabling the Cache Reload plugin. Set the url parameter to the url that will do handle forcing the reload. See the example below for what this url's output should look like.

Methods

init(oConfig)

Called by the BOOMR.init() method to configure the cache reload plugin.

Parameters

oConfig
The configuration object passed in via BOOMR.init(). See the Configuration section for details.

Returns

a reference to the BOOMR.plugins.CACHE_RELOAD object, so you can chain methods.

is_complete()

Called by BOOMR.sendBeacon() to determine if the bandwidth plugin has finished what it's doing or not. This method always returns true.

Returns

Beacon Parameters

This plugin does not add any parameters to the beacon.

Example HTML document

The cache reloading HTML document should look something like this:

<!doctype html>
<html>
<head>
<script src="boomerang.js"></script>
</head>
<body>
<script>
// required version needs to be passed in as a query string parameter
// like v=0.9.123456789

var boom_ver = BOOMR.version.split('.'),
    reqd_ver = location.search.replace(/.*v=([0-9\.]+).*/, '$1').split('.');
if (	(boom_ver[0] < reqd_ver[0])		// javascript will do type coercion
     || (boom_ver[0] == reqd_ver[0] && boom_ver[1] < reqd_ver[1])
     || (boom_ver[0] == reqd_ver[0] && boom_ver[1] == reqd_ver[1] && boom_ver[2] < reqd_ver[2])
)
{
	location.reload(true);
}
</script>
</body>
</html>