Skip to content

Commit 4b14333

Browse files
committed
Adding a note about a potential path + filename issue in Internet Explorer...
1 parent b7edc7c commit 4b14333

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# jquery.cookie
1+
# jquery.cookie
22

33
A simple, lightweight jQuery plugin for reading, writing and deleting cookies.
44

@@ -42,30 +42,50 @@ Delete cookie:
4242

4343
## Configuration
4444

45+
### raw
46+
4547
By default the cookie value is encoded/decoded when writing/reading, using `encodeURIComponent`/`decodeURIComponent`. Bypass this by setting raw to true:
4648

4749
$.cookie.raw = true;
4850

51+
### json
52+
4953
Turn on automatic storage of JSON objects passed as the cookie value. Assumes `JSON.stringify` and `JSON.parse`:
5054

5155
$.cookie.json = true;
5256

5357
## Cookie Options
5458

59+
### expires
60+
5561
Cookie attributes can be set globally by setting properties of the `$.cookie.defaults` object or individually for each call to `$.cookie()` by passing a plain object to the options argument. Per-call options override the default options.
5662

5763
expires: 365
5864

5965
Define lifetime of the cookie. Value can be a `Number` which will be interpreted as days from time of creation or a `Date` object. If omitted, the cookie becomes a session cookie.
6066

67+
### path
68+
6169
path: '/'
6270

6371
Define the path where the cookie is valid. *By default the path of the cookie is the path of the page where the cookie was created (standard browser behavior).* If you want to make it available for instance across the entire domain use `path: '/'`. Default: path of page where the cookie was created.
6472

73+
**Note regarding Internet Explorer:**
74+
75+
> Due to an obscure bug in the underlying WinINET InternetGetCookie implementation, IE’s document.cookie will not return a cookie if it was set with a path attribute containing a filename.
76+
77+
(From [Internet Explorer Cookie Internals (FAQ)](http://blogs.msdn.com/b/ieinternals/archive/2009/08/20/wininet-ie-cookie-internals-faq.aspx))
78+
79+
This means one cannot set a path using `path: window.location.pathname` in case such pathname contains a filename like so: `/check.html` (or at least, such cookie cannot be read correctly).
80+
81+
### domain
82+
6583
domain: 'example.com'
6684

6785
Define the domain where the cookie is valid. Default: domain of page where the cookie was created.
6886

87+
### secure
88+
6989
secure: true
7090

7191
If true, the cookie transmission requires a secure protocol (https). Default: `false`.

0 commit comments

Comments
 (0)