什么是“启用DOM存储API”意思? [英] What does "enable DOM storage API" mean?

查看:470
本文介绍了什么是“启用DOM存储API”意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现这个Android WebView功能 WebSettings.setDomStorageEnabled(true),而且从名字中我可以推断它只是启用DOM存储。



然而,Android文档提示略有不同:


设置DOM存储API是
启用。


IOW,它启用了 API 而不是存储本身。 / p>

我的问题是...我不知道这样一个API的存在,直到我遇到这个功能。



我的Google搜索表明,该API与 HTML5


  1. 这是否意味着此功能是
    与网站/页面无关,
    不要使用HTML5? IOW,
    是否影响现有的非HTML5页面
    加载&渲染?

  2. 在哪里可以进一步了解DOM
    存储API?

  3. ,有没有任何陷阱
    或警告,我需要看
    当调用
    WebSettings.setDomStorageEnabled(true)
    在Android应用中?

  4. 为什么默认情况下会禁用?

更新:我现在可以至少回答问题#2:事实证明,DOM存储的通用名称是Web存储,有一个关于这个的维基百科文章: http://en.wikipedia.org/wiki/Web_Storage

解决方案

我相信这个功能与不使用HTML 5规范的网站无关,因为它是该规范的一部分。我可以想象,启用此API时,需要注意的是,它将允许任何利用DOM存储的任何网站在设备上使用所述存储选项。我可以想象,默认情况下它将被禁用以节省空间和安全。


I came across this Android WebView function WebSettings.setDomStorageEnabled(true) and from the name alone I can infer that it simply "enables DOM storage".

The Android documentation, however, suggests something slightly different:

Set whether the DOM storage API is enabled.

IOW, it enables the API rather than the storage itself.

My problem is... I didn't know about the existence of such an API until I encountered this function.

My Google search suggests that this API is closely associated with HTML5.

  1. Does that mean that this function is irrelevant to web sites/pages that do not use HTML5? IOW, does it affect existing non-HTML5 page loading & rendering at all?
  2. Where can I learn more about the DOM storage API?
  3. In particular, are there any gotchas or caveats that I need to watch for when calling WebSettings.setDomStorageEnabled(true) in an Android app?
  4. Why is it disabled by default?

Update: I now can at least answer question #2: It turns out that the common name for "DOM Storage" is "Web Storage" and there is an entire Wikipedia article about this: http://en.wikipedia.org/wiki/Web_Storage

解决方案

I believe this functionality is irrelevant for websites that do not use the HTML 5 specifications, since it is part of that spec. I would imagine the main thing to look out for when enabling this API is that it would then allow ANY website that takes advantage of DOM storage to use said storage options on the device. I would imagine it is disabled by default for space savings and security.

这篇关于什么是“启用DOM存储API”意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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