Cookies on localhost with explicit domain

前端 未结 21 1789
[愿得一人]
[愿得一人] 2020-11-22 04:17

I must be missing some basic thing about cookies. On localhost, when I set a cookie on server side and specify the domain explicitly as localhost (or .localhost). t

21条回答
  •  情歌与酒
    2020-11-22 05:14

    document.cookie = valuename + "=" + value + "; " + expires + ";domain=;path=/";

    this "domain=;path=/"; will take dynamic domain as its cookie will work in subdomain. if u want to test in localhost it will work

提交回复
热议问题