Back to Content

Window: caches property

files/en-us/web/api/window/caches/index.md

latest738 B
Original Source

{{APIRef("Service Workers API")}}{{securecontext_header}}

The caches read-only property of the {{domxref("Window")}} interface returns the {{domxref("CacheStorage")}} object associated with the current context. This object enables functionality such as storing assets for offline use, and generating custom responses to requests.

Value

A {{domxref("CacheStorage")}} object.

Examples

The following example shows how a window can retrieve cached data.

js
caches.open("v1").then((cache) => cache.match("/list"));

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also