How to manage cookies - with JavaScript or with HTTP Set-Cookie?
You should set your cookies wherever it's most convenient.
That probably means that some cookies will come from the server and some from the client.
Note, however, that, for security reasons, high-risk cookies (such as a login token) should be HTTP-Only so that they cannot be accessed from Javascript.
(It goes without saying that they should be SSL-only)
I am creating a web application within GAE environment. It heavily uses AJAX/JSON to send/receive data and all about that. I don't worry much about browsers with JS disabled and obsolete browsers as it's my personal project and I am trying to make it simple and not bloated in code. So, I use JavaScript heavily in the project. Please advise me how to manage cookies and sessions in that case better. I have two variants - use HTTP Set-Cookie where possible and JavaScript where it's not. The second is opposite - use JavaScript where possible. Both variants work fine now but I want to make it right way. With JavaScript scenario when there a cookie needs to be set, I get some data over AJAX with some keys, then with a jQuery plugin set these keys to cookies and vice versa, read cookies with JS and send them over AJAX. What a re pros and cons of both methods? Thanks!