我正在尝试保存由我动态叠加的图像的src,因此,每当我注销我的网站时,我都必须再次上传该图像以用于网站徽标图片
答案 0 :(得分:0)
我猜您正在随身携带客户端。因此,您可以改用cookie。
function setCookie(name, value, days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
document.cookie = name + "=" + value +
expires + "; path=/";
}
function getCookie(name) {
var cArr = document.cookie.split(';');
for(var i=0;i < cArr.length;i++) {
var cookie = cArr[i].split("=",2);
cookie[0] = cookie[0].replace(/^\s+/,"");
if (cookie[0] == name){ return cookie; }
}
}
setCookie("src", "c:\myimage.png", 10000);
var c1 = getCookie("src");
console.log(c1)