Skip to content

javascript set cookie doesn’t work on chrome android

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=/';

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 ?



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=/';

And that work on chrome/mozilla on computer and android