javascript set cookie with expire time

后端 未结 8 719
日久生厌
日久生厌 2020-11-27 14:03

I am setting a cookie by Javascript and it is working fine but it is not taking the expire time I am giving. It keeps on taking session value regardless of what I give, belo

8条回答
  •  难免孤独
    2020-11-27 14:16

    document.cookie = "cookie_name=cookie_value; max-age=31536000; path=/";
    

    Will set the value for a year.

提交回复
热议问题