From 589e24fc829e1a5ff9827985f453720a4a6c804e Mon Sep 17 00:00:00 2001 From: MDN Date: Sat, 2 Oct 2021 00:48:46 +0000 Subject: [CRON] sync translated content --- files/zh-cn/web/api/window/crypto/index.html | 117 --------------------------- 1 file changed, 117 deletions(-) delete mode 100644 files/zh-cn/web/api/window/crypto/index.html (limited to 'files/zh-cn/web/api/window') diff --git a/files/zh-cn/web/api/window/crypto/index.html b/files/zh-cn/web/api/window/crypto/index.html deleted file mode 100644 index d8a732b86e..0000000000 --- a/files/zh-cn/web/api/window/crypto/index.html +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: Window.crypto -slug: Web/API/Window/crypto -translation_of: Web/API/Window/crypto ---- -
{{APIRef}}
- -

Window.crypto只读属性返回与全局对象关联的 {{domxref("Crypto")}}对象。 此对象允许网页访问某些加密相关服务。

- -

语法

- -
var cryptoObj = window.crypto || window.msCrypto; // for IE 11
-
- -

范例

- -

使用 {{domxref("Window.crypto")}} 来访问getRandomValues() 方法.

- -

JavaScript

- -
genRandomNumbers = function getRandomNumbers() {
-  var array = new Uint32Array(10);
-  window.crypto.getRandomValues(array);
-
-  var randText = document.getElementById("myRandText");
-  randText.innerHTML = "The random numbers are: "
-  for (var i = 0; i < array.length; i++) {
-    randText.innerHTML += array[i] + " ";
-  }
-}
-
- -

HTML

- -
<p id="myRandText">随机数字: </p>
-<button type="button" onClick='genRandomNumbers()'>生成10个随机数字</button>
- -

结果

- -

{{ EmbedLiveSample('Example') }}

- -

规范

- - - - - - - - - - - - - - -
规范状态批注
{{SpecName("Web Crypto API", "#dfn-GlobalCrypto", "Window.crypto")}}{{Spec2("Web Crypto API")}}Initial definition
- -

浏览器支持

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerEdgeOperaSafari
Basic support44 {{CompatVersionUnknown}}{{CompatVersionUnknown}}11 {{property_prefix("ms")}}2019{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureChrome for AndroidFirefox MobileFirefox OSIE PhoneOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

另见

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