Setting multiple cookies in Javascript

后端 未结 3 964
孤城傲影
孤城傲影 2021-02-07 03:11

I\'m trying to set multiple cookies in document.cookie, but unfortunately only one is getting added.

I know there are multiple examples present on the \'Net

3条回答
  •  甜味超标
    2021-02-07 03:54

    Cookies are key value pairs (with some optional additional info added on, like the expiry date). To set more than one, you just set document.cookie more than once. The ; separator is used to specify the additional info, not to add more different cookies.

提交回复
热议问题