このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

ServiceWorkerRegistration.index

利用可能性は限定的

この機能はベースラインではありません。最も広く使用されているブラウザーの一部で動作しません。

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

indexServiceWorkerRegistration インターフェイスの読み取り専用プロパティで、オフラインコンテンツの索引付けができる ContentIndex インターフェイスへの参照を返します。

ContentIndex オブジェクトです。

このプロパティはメインスクリプトと登録済みサービスワーカーのどちらからでもアクセスできます。

ここでは、メインスクリプトからアクセスする例を示します。

js
// reference registration
const registration = await navigator.serviceWorker.ready;

// feature detection
if ("index" in registration) {
  // Content Index API functionality
  const contentIndex = registration.index;
}

サービスワーカーからの呼び出し例です。

js
// service worker script

const contentIndex = self.registration.index;

仕様書

仕様書
Content Index
# dom-serviceworkerregistration-index

ブラウザーの互換性

関連情報