-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
40 lines (27 loc) · 914 Bytes
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
title: "Window: caches property"
short-title: caches
slug: Web/API/Window/caches
page-type: web-api-instance-property
browser-compat: api.caches
---
{{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
window.caches.open("v1").then((cache) => {
return cache.match("/list");
});
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [Service Workers](/en-US/docs/Web/API/Service_Worker_API)
- {{domxref("CacheStorage")}}
- {{domxref("Cache")}}