i have a problem to set a cookie on chrome on my android phone.
The source code is upload on an online server.
here my javascript code :
function updateCookie( value ) {
document.cookie = 'l='+value+'; expires=Thu, 2 Aug 240 20:47:11 UTC; path=/';
location.reload();
}
it work on chrome/mozilla on my computer
it work on mozilla on my android phone
but it doesen’t work on chrome on my android phone
Can sommeone have an issue ?
Advertisement
Answer
I found the problem : the date was invalid.
I modify my function to this
function updateCookie( langue ) {
// today + 1 year
var exdate = new Date().getTime() + (1000*60*60*24*7*52);
var date_cookie = new Date(exdate).toUTCString();
document.cookie = 'l='+value+'; expires='+date_cookie+'; path=/';
location.reload();
}
And that work on chrome/mozilla on computer and android