开发者

What does "enable DOM storage API" mean?

开发者 https://www.devze.com 2023-03-02 12:02 出处:网络
I came across this Android WebView function WebSettings.setDomStorageEnabled(true) and from the name alone I can infer that it simply \"enables DOM storage\".

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.setDomStorageEna开发者_开发问答bled(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.


  1. No. You will have to use it to enable some features of JS functionality as well.

  2. devloper.android link:
    http://developer.android.com/reference/android/webkit/WebSettings.html#setDomStorageEnabled%28boolean%29/

    MDN explnation about DOM storage: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage

  3. You need to know there are security attacks that can be made (if you use it with js).

  4. It opens some security vulnerabilities of the system.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号