Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

swapCache method

Swaps an old cache for a newer one.

Internet Explorer 10



var retval = ApplicationCache.swapCache();


This method has no parameters.

Return value


This method can return one of these values.

Return code/valueDescription

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




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



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




© 2016 Microsoft