Get cookie by name

前端 未结 30 1386
野的像风
野的像风 2020-11-22 03:58

I have a getter to get the value from a cookie.

Now I have 2 cookies by the name shares= and by the name obligations= .

I want to

30条回答
  •  长情又很酷
    2020-11-22 04:25

    If you just need to check if some cookie exist then simple do this:

    document.cookie.split('logged=true').length == 2
    

    if cookie logged=true exist, you will get 2, if not 1.

    logged=true - change this to you cookie name=value, or just a name

提交回复
热议问题