I'm using this library for a JQuery plugin I'm coding... I save inside a cookie a specific data created by the user in this way:
// Update cookies checks if the cookie esists.
// If cookie exists => push data {myData:[obj1[, obj2, [...], objN]]}
// If cookie doesn't exists => create cookie with {myData:[obj1]}
function _updateCookie(name, cookie, data) {
// Check if cookie exists
var cookies = {myData:[]};
// _getCookie(name) { return Cookies.get(name) }
if (_getCookie(name) != undefined) {
cookies = _getCookie(name);
}
cookies.reminders.push(cookie);
Cookies.set(name, cookies, data);
}
DATA:
var data = {
expires: 1,
path: '/',
domain: '',
secure: true
}
COOKIE:
var cookie = {
myData: [
1: myObject1,
2: myObject2,
// [...]
n: myObjectN
],
}
When I call _getCookie(name)
it always returns undefined
. I've also tried to list the cookies with:
console.log(Cookies.get());
// log: Object {_ga: "GA1.1.402426237.1450622600"}
But if i look at chrome://settings/cookies i see:
2 cookies on localhost [_ga], [myCookie]
Any suggestion of what am I doing wrong?
EDIT
I saw that the problem comes out when i call Cookie.set();
with this values
Cookies.set('myCookie', {[expires: ...], path: '', domain: ''});
if I call
Cookies.set('myCookie'{[expires: ...]});
I can get the cookie with no problems.