で必要なクッキーのためにこれを試してみました:ローカルストレージのために
var date = new Date();
var cars = ["Saab", "Volvo", "BMW"];
date.setTime(date.getTime() + (30 * 60 * 1000)); //Expires in 30 minutes
$.cookie("cookieName", cars, { expires: date });
alert($.cookie("cookieName"));
:
var cars = ["Saab", "Volvo", "BMW"];
localStorage.setItem('name', cars);
date.setTime(date.getTime() + (30 * 60 * 1000));
var date = new Date();
localStorage.setItem('expiretime', date);
if(localStorage.getItem('expiretime') > Date()) {
alert(localStorage.getItem('name'));
}
セッションの場合:
var cars = ["Saab", "Volvo", "BMW"];
$.session.set("name", cars);
date.setTime(date.getTime() + (30 * 60 * 1000));
var date = new Date();
$.session.set("expiretime", date);
if($.session.get('expiretime') > Date()) {
alert($.session.get('name'));
}
コードはありません。何を試しましたか? – eisbehr