aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/navigatorstorage/storage/index.html
blob: 631ec750bf8437737e718a2b32ff7df017b77703 (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
title: NavigatorStorage.storage
slug: Web/API/NavigatorStorage/storage
tags:
  - API
  - Navigator
  - WorkerNavigator
  - 存储
  - 安全上下文
  - 属性
translation_of: Web/API/NavigatorStorage/storage
---
<p>{{securecontext_header}}{{APIRef("Storage")}}</p>

<p><span class="seoSummary"> <code><strong>NavigatorStorage.storage</strong></code> 是一个只读属性,返回单例 {{domxref("StorageManager")}} 对象,用于访问当前网站或应用程序的浏览器整体存储功能的。 </span>通过返回的对象,您可以检查和配置数据存储的持久性,并了解您的浏览器使用的大约多少空间用于本地存储。</p>

<h2 id="语法">语法</h2>

<pre class="syntaxbox">var <em>storageManager</em> = navigator.storage;
</pre>

<h3 id="返回值">返回值</h3>

<p>返回 {{domxref("StorageManager")}} 您可以用来维护数据的持久化存储,以及大致确定有多少空间来存储数据。</p>

<h2 id="规范">规范</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Storage', '#navigatorstorage', 'navigator.storage')}}</td>
   <td>{{Spec2('Storage')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

<div>
<div class="hidden">此页面上的兼容性表格由结构化数据生成。 如果您想为数据做出贡献,请查看 <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> 并提交 pull request.</div>

<p>{{Compat("api.NavigatorStorage.storage")}}</p>
</div>

<h2 id="相关链接">相关链接</h2>

<ul>
 <li>{{domxref("NavigatorStorage")}}</li>
 <li>{{domxref("StorageManager")}}</li>
 <li>{{domxref("Navigator")}}</li>
 <li>{{domxref("WorkerNavigator")}}</li>
</ul>