yankleber
09-12-2014, 05:28 PM
Hey all!
I am having this issue with cookies. As far as I know it is not rocket science so I don't know what can be going wrong here.
I have tested it with Chrome and Firefox. Both browsers are showing the same behavior: the 'cookied' data remains saved as long as keep the browser opened. I can even close the tab where the cookies were saved since the application stays opened. But if I close completely the program the cookies are gone.
I thought that it could be the expire thing and double checked it but got nothing. Here how I am saving the cookies:
function SetCookies() {
var d = new Date().addHours(24);
var n = d.toUTCString();
document.cookie = "name=" + document.getElementById('name').value;
document.cookie = "over_18=" + (document.getElementById('yover').checked ? 'Y' : 'N');
document.cookie = "expires=" + n;
document.cookie = "path=/";
}
Date.prototype.addHours= function(h){
this.setHours(this.getHours()+h);
return this;
}
Do you see something wrong?
Thanks!
:confused:
I am having this issue with cookies. As far as I know it is not rocket science so I don't know what can be going wrong here.
I have tested it with Chrome and Firefox. Both browsers are showing the same behavior: the 'cookied' data remains saved as long as keep the browser opened. I can even close the tab where the cookies were saved since the application stays opened. But if I close completely the program the cookies are gone.
I thought that it could be the expire thing and double checked it but got nothing. Here how I am saving the cookies:
function SetCookies() {
var d = new Date().addHours(24);
var n = d.toUTCString();
document.cookie = "name=" + document.getElementById('name').value;
document.cookie = "over_18=" + (document.getElementById('yover').checked ? 'Y' : 'N');
document.cookie = "expires=" + n;
document.cookie = "path=/";
}
Date.prototype.addHours= function(h){
this.setHours(this.getHours()+h);
return this;
}
Do you see something wrong?
Thanks!
:confused: