Pregunta

I'm trying to implement an answer from another question on this site:

Detect when browser receives file download

I've followed all of the steps and everything is working up to the point where I try to retrieve the cookie. When I use Firebug I can see the cookie that I created in the header response, along with a cookie that was created earlier in the app by javascript.

The info in firebug for the two cookies is: name:earlierCookie,value:1234,Domain:localhost,Path:/,Expires:Session,HttpOnly:false name:cookiefromServer,value:5678,Domain:localhost,Path:/resource/upload/file,Expires:Session,HttpOnly:false

So, you can see that the cookies are in the same domain (they have different paths). When looking at document.cookie, only earlierCookie is present.

Why can I see cookieFromServer in Firebug and not in document.cookie?

Also, please tell me if I need to post more info.

¿Fue útil?

Solución

I figured this out on my own. The problem is the path. Setting path to / from the server allows the cookie to show up in document.cookie I have no idea why this is and can't find good resources explaining it.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top