Javascript [removed] always empty string

前端 未结 5 1082
执念已碎
执念已碎 2020-11-30 01:53

I have this real strange problem with client side javascript setting cookies. I\'m developing a little 1 page demo at the moment to use cookies to store some \'preferences\'

5条回答
  •  一向
    一向 (楼主)
    2020-11-30 02:08

    You might have set a wrong path for the cookie.

    In my case I'd set the path in the cookie to /foo because the application is normally on address http://example.org/foo. However, during tests I'd opened the application on the default address http://localhost:3000 which allowed me to create cookies with the path /foo but not read them. The solution was to test the application on address http://localhost:3000/foo.

提交回复
热议问题