关于userData

[b]userData 的容量限制:[/b]

Security Zone Document Limit (KB) Domain Limit (KB)
Local Machine 128 1024
Intranet 512 10240
Trusted Sites 128 1024
Internet 128 1024
Restricted 64 640


/* IE6/7的本地存储可以使用userData来实现。不过userData有一个缺陷:无法跨目录使用。 例如:
www.test.com/a.html
www.test.com/b/b.html
www.test.com/c/c.html
这3个页面,userData数据时独立的,无法共享。

UserData 在XP的存放路径:
C:\Documents and Settings\shawn\UserData
*/
var Userdata = {
storageObject: null,
initialize: function() {
if (!this.storageObject) {
this.storageObject = document.createElement("div");
this.storageObject.addBehavior("#default#userData");
this.storageObject.style.display = "none";
document.body.appendChild(this.storageObject);
}
},
set: function(key, value) {
if (!this.storageObject){
this.initialize();
}
this.storageObject.setAttribute(key, value);
this.storageObject.save("OfflineStorage");
return value;
},
get : function(key){
if (!this.storageObject){
this.initialize();
}
this.storageObject.load("OfflineStorage");
return this.storageObject.getAttribute(key);
},
del: function(key) {
if (!this.storageObject){
this.initialize();
}
this.storageObject.removeAttribute(key);
this.storageObject.save("OfflineStorage");
}
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值