Window: caches プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2018.

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。

cachesWindow インターフェイスの読み取り専用プロパティで、現在のコンテキストに関連付けられた CacheStorage オブジェクトを返します。 このオブジェクトにより、オフライン利用のために資産 (assets) を保存したり、リクエストに対するカスタムレスポンスを生成したりするなどの機能を使用できます。

CacheStorage オブジェクト。

次の例は、ウィンドウがキャッシュされたデータを取得する方法を示しています。

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

仕様書

Specification
Service Workers
# self-caches

ブラウザーの互換性

関連情報