Sharing cookies between many pages?
开发者_运维技巧Is it possible to use cookies set by one page (say page1.html) by another page (say page2.html) in the same web site?
As I recall, it depends on what path you give for the cookie. If you write to a path and then request from that path inside the same domain you will have access to that cookie value.
from a server side perspective (courtesy of wikipedia)
Set-Cookie: name=newvalue; expires=date; path=/; domain=.example.org
Often path is set to the pages relative path so that vars are retained for just that page, maybe for summary/detail choice on that page. For other cookies you set the path to / so you can access a common value like rowsPerPage or something similar thats site wide.
heres a wikipedia link: http://en.wikipedia.org/wiki/HTTP_cookie
Cookie is shared by default if you correctly specify the domain and the path.
The cookie is stored in the client browser for the current domain
Read more about it here : link text
精彩评论