From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/storage/key/index.html | 130 ++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 files/ja/web/api/storage/key/index.html (limited to 'files/ja/web/api/storage/key') diff --git a/files/ja/web/api/storage/key/index.html b/files/ja/web/api/storage/key/index.html new file mode 100644 index 0000000000..6fc7067247 --- /dev/null +++ b/files/ja/web/api/storage/key/index.html @@ -0,0 +1,130 @@ +--- +title: Storage.key() +slug: Web/API/Storage/key +tags: + - API + - Method + - Reference + - Storage + - Web Storage +translation_of: Web/API/Storage/key +--- +

{{APIRef}}

+ +

{{domxref("Storage")}} インターフェイスの key() メソッドは数値 n を渡すと、ストレージ内で n 番目のキーの名称を返します。キーの順序はユーザエージェント依存であり、この順序に頼るべきではありません。

+ +

構文

+ +
var aKeyName = storage.key(key);
+ +

引数

+ +
+
key
+
名称を取得したいキーの番号を表す整数。これは 0 から始まるインデックスです。
+
+ +

戻り値

+ +

キーの名称を持つ {{domxref("DOMString")}}。

+ +

+ +

以下の関数は、ローカルストレージのキー全体に対して反復処理を行います:

+ +
function forEachKey(callback) {
+  for (var i = 0; i < localStorage.length; i++) {
+    callback(localStorage.key(i));
+  }
+}
+ +
+

注記: 実際の例として、Web Storage Demo をご覧ください。

+
+ +

仕様

+ + + + + + + + + + + + + + +
仕様書策定状況コメント
{{SpecName('Web Storage', '#dom-storage-key', 'key()')}}{{Spec2('Web Storage')}} 
+ +

ブラウザ実装状況

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
機能ChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
localStorage43.5810.504
sessionStorage52810.504
+
+ +
+ + + + + + + + + + + + + + + + + + + +
機能AndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
基本サポート2.1{{CompatUnknown}}811iOS 3.2
+
+ +

すべてのブラウザで、localStorage および sessionStorage が受け入れる容量は異なります。さまざまなブラウザのストレージ容量を報告しているページがあります。

+ +
+

注記: iOS 5.1 より Safari Mobile は localStorage データを cache フォルダに保存しており、概して空き容量が少ない場合に OS の要求により、時々クリーンアップを受けます。

+
+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf