Safari Developer Library

Developer

DOMApplicationCache Class Reference

Options
Deployment Target:

On This Page

DOMApplicationCache

A DOMApplicationCache object is used to store resources—such as, HTML, JavaScript, CSS, and images—locally. This allows your web application to continue running offline when there is no network connection. The cache persists after Safari exits, so it can be used by multiple browser sessions. There is one application cache per browsing context.

Inheritance


  • DOMApplicationCache

Conforms To


Not Applicable

Import Statement


Not Applicable Not Applicable

Availability


Available in Safari 4.0 and later.
Available in iOS 2.2 and later.
  • status Property

    The current status of the application cache. One of the values described in "Constants.”

    Declaration

    JavaScript

    readonly attribute unsigned short status

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • onchecking Property

    Sent when the cache update process begins.

    Declaration

    JavaScript

    attribute EventListener onchecking

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • onerror Property

    Sent when an error occurs.

    Declaration

    JavaScript

    attribute EventListener onerror

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • onnoupdate Property

    Sent when the update process finishes but the manifest file does not change.

    Declaration

    JavaScript

    attribute EventListener onnoupdate

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • ondownloading Property

    Sent when the update process begins downloading resources in the manifest file.

    Declaration

    JavaScript

    attribute EventListener ondownloading

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • onprogress Property

    Sent when each resource in the manifest file begins to download.

    Declaration

    JavaScript

    attribute EventListener onprogress

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • onupdateready Property

    Sent when there is an existing application cache, the update process finishes, and there is a new application cache ready for use.

    Declaration

    JavaScript

    attribute EventListener onupdateready

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • oncached Property

    Sent when the update process finishes for the first time—that is, the first time an application cache is saved.

    Declaration

    JavaScript

    attribute EventListener oncached

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • add

    Forthcoming

    Declaration

    JavaScript

    void add (in DOMString uri);

    Discussion

    Forthcoming

    Availability

    Available in iOS 2.1 through iOS 2.2.

  • Manually triggers the update process.

    Declaration

    JavaScript

    void update ();

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • Replaces the active cache with the latest version.

    Declaration

    JavaScript

    void swapCache ();

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

Constants

Constants that indicate the status of the application cache.

Constants

  • UNCACHED

    UNCACHED

    The object isn’t associated with an application cache. This can occur if the update process fails and there is no previous cache to revert to, or if there is no manifest file.

    • const unsigned short UNCACHED = 0;

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • IDLE

    IDLE

    The cache is idle.

    • const unsigned short IDLE = 1;

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • CHECKING

    CHECKING

    The update has started but the resources are not downloaded yet—for example, this can happen when the manifest file is fetched.

    • const unsigned short CHECKING = 2;

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • DOWNLOADING

    DOWNLOADING

    The resources are being downloaded into the cache.

    • const unsigned short DOWNLOADING = 3;

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • UPDATEREADY

    UPDATEREADY

    Resources have finished downloading and the new cache is ready to be used.

    • const unsigned short UPDATEREADY = 4;

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.