swapCache method

Swaps an old cache for a newer one.

Internet Explorer 10

Syntax

var retval = ApplicationCache.swapCache();

Parameters

This method has no parameters.

Return value

Type: HRESULT

This method can return one of these values.

Return code/valueDescription
S_OK
DOMException.INVALID_STATE_ERR
11

This exception is thrown if the status of the cache is invalid.

 

Exceptions

ExceptionCondition
InvalidStateError

TThis exception is thrown if the status of the cache is invalid. For versions earlier than Internet Explorer 10, INVALID_STATE_ERR is returned.

Remarks

In order to swap an old cache out for a new one, call update first. When the status is in the UPDATEREADY state, calling swapCache will make the swap.

Calling swapCache will not update any content on your page. It will simply allow your webpage to be able to access any further dynamic content from the new cache instead of the old one. After the page is refreshed, the newly created cache will be used for all in-page and dynamic requests.

The swapCache method is provided for convenience but is not necessary for basic functionality. Loading or refreshing the page is sufficient. For example, refreshing the page after an UpdateReady event will reload the page from the new cache without a call to swapCache.

swapCache does not cause previously-loaded resources to be reloaded; for example, images do not suddenly get reloaded, and style sheets and scripts do not get reparsed or reevaluated. The only change is that subsequent requests for cached resources will obtain the newer copies.

See also

ApplicationCache

 

 

Show:
© 2014 Microsoft