▲ | jmull 5 days ago | |||||||||||||
> minefield Cookies are a bit of a mess, but if you're going to use them, you can follow the standard and all will be well. Not so much a minefield, but a hammer; you just need to take some care not to hit yourself on the thumb. I guess the confusion here is that the browser is taking on the role of the server in setting the cookie value. In doing so it should follow the same rules any server should in setting a cookie value, which don't generally allow for raw JSON (no double-quote! no comma!). Either use a decent higher-level API for something like this (which will take care of any necessary encoding/escaping), or learn exactly what low-level encoding/escaping is needed. Pretty much the same thing you face in nearly anything to do with information communication. | ||||||||||||||
▲ | klysm 5 days ago | parent | next [-] | |||||||||||||
I don’t understand how that’s not a minefield, it’s easy to go astray? | ||||||||||||||
| ||||||||||||||
▲ | 5 days ago | parent | prev [-] | |||||||||||||
[deleted] |