Ada*_*dam 4 javascript internet-explorer local-storage
我在应用程序中使用localStorage.
我正在使用XOR bitshift操作在数据进入存储之前屏蔽数据.
这是掩蔽功能:
encrypt: function (str) {
var encoded = [];
if (!App.crypto.key) {
App.crypto.init();
}
for (var i = 0, len = str.length; i < len; i++) {
var a = str.charCodeAt(i);
var b = a ^ App.crypto.key.charCodeAt(App.crypto.key % i);
encoded.push(String.fromCharCode(b));
}
return encoded.join("");
}
Run Code Online (Sandbox Code Playgroud)
我在这种情况下使用的密钥的值是"MWZ2cyt2N3JwejhxUjA2V3ptRmwxcmVvU09IbFhORHdOcDRiWGh5SGRZMFU4Ym9VY1Y1WXU5c2d6OXhBdU9wTSt1MlpqcmhXOVBRPQ0K"
当我在IE9中屏蔽"[]"时,我会得到一些怪人角色.当我尝试将其设置为localStorage时,它会给我一个无效的参数错误.有人知道发生了什么吗?