TML5WEBStorage-localStorage存储位置在哪

localStorage作为客户端浏览器持久化存储方案

这个是浏览器隔离的,每个浏览器都会把localStorage存储在自己的UserData中,如chrome一般就是

C:\Users\你的计算机名\AppData\Local\Google\Chrome\User Data\Default\Local Storage
如果要在浏览器查看,打开调试工具(F12),在application选项卡下可以查看。

 

$(document).ready(function () {

$('.sign-in').on('click',function(){
var storage=window.localStorage;
// console.log(storage.sign_timestamp);
if(typeof(storage.sign_timestamp) == "undefined"){
var timestamp = Date.parse(new Date());
timestamp = timestamp / 1000;
storage.sign_timestamp = timestamp;
console.log("初始化");
flag = false;
}else{
flag = true;
}
if(flag){
sign_url();
// window.location.href = '';
}else{
layer.open({
shadeClose: false,
title: ' ',
type:1,
shade: 0.5,
area: ['550px', '343px'],
content: $('.sign-in-content')
});
}
});

$('.register').on('click',function () {
var storage=window.localStorage;
// console.log(storage.register_timestamp);
if(typeof(storage.register_timestamp) == "undefined"){
var timestamp = Date.parse(new Date());
timestamp = timestamp / 1000;
storage.register_timestamp = timestamp;
console.log("初始化");
flag = false;
}else{
flag = true;
}
if(flag){
register_url();
}else{
layer.open({
shadeClose: false,
title: ' ',
type:1,
shade: 0.5,
area: ['550px', '343px'],
content: $('.register-content')
});
}


});
// $(function () {
var newYear = new Date;
var year = newYear.getFullYear()
$('.year').text(year)
// })
// $('#register').on('click',function () {
// $('.register').hide();
// $('.sign-in').hide();
// $('.username').show()
// })
// $('.username').on('mouseover',function () {
// $('.out').show();
// })
// $('.out').on('mouseout',function () {
// $('.out').hide();
// })
// $('.out').on('click',function () {
// $('.username').hide();
// $('.register').show();
// $('.sign-in').show();
// })
})

posted @ 2018-06-26 11:31  星云惊蛰  阅读(153)  评论(0)    收藏  举报