A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/apis/appcache/ApplicationCache/update below:

update · WebPlatform Docs

update Summary

Invokes the application cache download process. Throws an InvalidStateError exception if there is no application cache to update. Calling this method is not usually necessary, as user agents will generally take care of updating application caches automatically. The method can be useful in situations such as long-lived applications. For example, a Web mail application might stay open in a browser tab for weeks at a time. Such an application could want to test for updates each day.

Method of apis/appcache/ApplicationCacheapis/appcache/ApplicationCache

Syntax
var result = window.applicationCache.update();
Return Value

Returns an object of type nullnull

Type: HRESULT

This method can return one of these values.

S_OK DOMException.INVALID_STATE_ERR

11

This exception is thrown if the application cache cannot be found or the status of the cache is obsolete. Examples
var applicationCache = window.applicationCache;



applicationCache.update();  

if (applicationCache.status == window.applicationCache.UPDATEREADY) {

    applicationCache.swapCache();  

        if (confirm('A new version of this site is available. Do you want to load it?')) {

            window.location.reload();

        }

}
Notes

Use this method and check the status before using swapCache.

The update method returns before the update check is complete, so it is a best practice to wait before checking the status property or calling the swapCache method.

The update method is provided for convenience, but is not necessary for basic functionality. Loading or refreshing the page is sufficient.

Related specifications
W3C ApplicationCache Specification
W3C Editor’s Draft
Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4