如何在Chrome中使用SubtleCrypto(window.crypto.subtle未定义) [英] How to use SubtleCrypto in chrome (window.crypto.subtle is undefined)

查看:424
本文介绍了如何在Chrome中使用SubtleCrypto(window.crypto.subtle未定义)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这确实使人尴尬

实际上在互联网上的任何站点上,

on virtually any site on the internet,

window.crypto.subtle

返回

SubtleCrypto {}
  __proto__: SubtleCrypto

在chrome控制台中(v61(正式版本)(64位))

in the chrome console (v61 (Official Build) (64-bit))

我的网页,以及 blank.org

其中

window.crypto.subtle

返回

undefined

根据 https:// developer.mozilla.org/zh-CN/docs/Web/API/Crypto/subtle
这是一个只读属性,应始终返回SubtleCrypto对象。

according to https://developer.mozilla.org/en-US/docs/Web/API/Crypto/subtle it's a read-only property that should always return a SubtleCrypto object.

我该怎么办,或者blank.org做了什么却做不到?

what could I have done, or what has blank.org done that it could possibly not?

ps:在firefox中,它似乎可以在我的网站和blank.org上正常工作

ps: in firefox it seems to work as intended on both my site and blank.org

推荐答案

根据规范(通过Github问题) 用于WebCrypto的Google页面


crypto.subtle在不安全的上下文中应该是未定义的

crypto.subtle is supposed to be undefined in insecure contexts

这篇关于如何在Chrome中使用SubtleCrypto(window.crypto.subtle未定义)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆