Reputation: 2700
Maybe this is a basic question. but I still not sure jquery cookie
, save cookies in where?
like this one: http://code.google.com/p/cookies/wiki/Documentation
the cookies save in server part or in custom browser part?
I guess save in custom browser part. jquery cookie
just is a tool, it should be like php cookie/session
, save each cookie depends on different URL
.
But when I see it need set domain
and path
. I am puzzed, if it depends on different URL
, why not use domain
+ window.location.hash
? the path
for what?
Upvotes: 1
Views: 875
Reputation: 349002
"JQuery cookie" is a simple tool which makes use of document.cookie
. This basic JavaScript feature stores cookies at the user's browser.
A cookie can be defined with some properties:
max-age
- Expiration date in seconds (Jquery implementation: {expires: __}
in days)domain
- By default, a cookie is saved at the current domain. It's however possible to change the domain to any domain from the current subdomain to the top domain (sub.sub2.top.nl
-> sub2.top.nl
-> top.nl
, but not another.top.nl
).path
- By default, the cookie is applied to /
. It's possible to change this default, so that only a specific directory is matched.secure
- This flag can be added through passing secure: true
in JQuery. When this option is set, cookies are targeted at the HTTPS protocol only.Upvotes: 2