phonegap系列之API(2)localStorage
phonegap系列之API(二)localStorage
pg提供对W3C Storage接口的访问:
var storage = window.localStorage;
方法:
- key 返回指定位置的键的名字
- getItem 返回指定键对应的值
- setItem 存储一个键值对
- removeItem 删除指定的键对应的值
- clear 删除所有的键值对
移动端支持情况:
注释:
如果没有,返回的多是null
扩展阅读:
http://zhangyaochun.iteye.com/blog/1405451