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/clear/index.html | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 files/ja/web/api/storage/clear/index.html (limited to 'files/ja/web/api/storage/clear') diff --git a/files/ja/web/api/storage/clear/index.html b/files/ja/web/api/storage/clear/index.html new file mode 100644 index 0000000000..7b99c0b3f0 --- /dev/null +++ b/files/ja/web/api/storage/clear/index.html @@ -0,0 +1,67 @@ +--- +title: Storage.clear() +slug: Web/API/Storage/clear +tags: + - API + - Method + - Reference + - Storage + - Web Storage +translation_of: Web/API/Storage/clear +--- +

{{APIRef("Web Storage API")}}

+ +

clear() は {{domxref("Storage")}} インターフェイスのメソッドで、指定された Storage オブジェクトに格納されているすべてのキーを消去します。

+ +

構文

+ +
storage.clear();
+ +

返値

+ +

{{jsxref("undefined")}} です。

+ +

+ +

以下の関数はローカルストレージに 3 個のデータアイテムを作成して、 clear() を使用してすべて削除します。

+ +
function populateStorage() {
+  localStorage.setItem('bgcolor', 'red');
+  localStorage.setItem('font', 'Helvetica');
+  localStorage.setItem('image', 'miGato.png');
+
+  localStorage.clear();
+}
+ +
+

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

+
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('HTML WHATWG', 'webstorage.html#dom-storage-clear', 'Storage.clear')}}{{Spec2('HTML WHATWG')}}
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.Storage.clear")}}

+ +

関連情報

+ +

Web Storage API の使用

-- cgit v1.2.3-54-g00ecf