jQuery $.cookie not reading cookie set by server response

jquery, jquery-cookie

Solution

The problem is that the server side is sending the cookies with the HttpOnly setting as described here: http://en.wikipedia.org/w/index.php?title=HTTP_cookie#HttpOnly_cookie

Cookies sent this way are not accessible thru document.cookie. This is generally used to help protect the cookie value against possible XSS attacks on your site.

Edit: You didn't mention which technology you're using on the server side to set the cookies. In case you're using PHP, this link lists the possible ways the HttpOnly flag could be set:

https://www.owasp.org/index.php/HttpOnly#Using_PHP_to_set_HttpOnly

Problem

$.cookie is not reading cookies that have been previously set by the server response. I can read cookies that have been set with $.cookie(). I can see all domain cookies set with Firefox's Web Developer add on. Also, the server side can see the request cookies, so the browser definitely has them. I have experimented with expiry times with no avail.

Original source