The question says it all. I realize that all options do work in up-to-date browsers, but what is the semantically best choice, and why?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
Good question. According to W3C standards, the correct is window.localStorage because the localStorage attribute is part of window object. And it is not a function, it is an attribute.
Source: http://dev.w3.org/html5/webstorage/#dom-localstorage Example: http://www.rajdeepd.com/articles/chrome/localstrg/LocalStorageSample.htm