0

I have cookies list like this

 key value domain expiry HTTP usid 1234567 abc.domain.com 2014-12-01T23:54:12.256Z yes ssid 1234534 abc.domain.com 2014-12-01T23:54:12.256Z yes _ga GA1.1.323232323 domain.com 2014-12-01T23:54:12.256Z no 

When I use $.cookie to get the cookies the output is

object _ga: "GA1.1.323232323" lang: "en" 

also document.cookie returns the same result How can I get all the cookies present

2 Answers 2

1

I believe that you are dealing with HttpOnly cookies, which cannot be retrived through JavaScript. All accessible cookies should be returned by document.cookie.

If you have control over the server-side, then make sure that the HttpOnly option is not use for these if you want them to be accessible on the client.

It's also possible that the abc.domain.com cookies aren't returned because that's not the same domain as domain.com - Pointy

Sign up to request clarification or add additional context in comments.

6 Comments

It's also possible that the abc.domain.com cookies aren't returned because that's not the same domain as domain.com.
@Pointy Are they really considered two seperate domains, even if one is a sub-domain of the other?
Well in general the same-origin policy treats the domain as a string in a "dumb" way, so I would not be surprised if that applied to cookies too.
yes the usid, ssid are httponly cookies, how can I clear those cookies
@hariszaman You want to clear them or read them on the client, it's not clear.
|
0

The cookies that you are not seeing may be HttpOnly cookies. This means that they cannot been seen using Javascript.

You can see them using a network trace tool or most browsers dev tools will show them in the network trace.

Look for headers that have the HttpOnly attribute like this

Set-Cookie: <name>=<value>[; <Max-Age>=<age>][; expires=<date>][; domain=<domain_name>][; path=<some_path>][; secure][; HttpOnly] 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.