You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 14d0f0c
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,19 +29,19 @@ Include the script (unless you are packaging scripts somehow else):
29
29
**Do not include the script directly from GitHub (http://raw.github.com/...).** The file is being served as text/plain and as such being blocked
30
30
in Internet Explorer on Windows 7 for instance (because of the wrong MIME type). Bottom line: GitHub is not a CDN.
31
31
32
-
js-cookie supports [npm](https://www.npmjs.com/) and [Bower](http://bower.io/) under the name `js-cookie`
32
+
js-cookie supports [npm](https://www.npmjs.com/package/js-cookie) and [Bower](http://bower.io/search/?q=js-cookie) under the name `js-cookie`
33
33
34
34
It can also be loaded as an AMD or CommonJS module.
35
35
36
36
## Basic Usage
37
37
38
-
Create a session cookie, valid to the current page:
38
+
Create a session cookie, valid to the path of the current page:
39
39
40
40
```javascript
41
41
Cookies.set('name', 'value');
42
42
```
43
43
44
-
Create a cookie that expires 7 days from now, valid to the current page:
44
+
Create a cookie that expires 7 days from now, valid to the path of the current page:
45
45
46
46
```javascript
47
47
Cookies.set('name', 'value', { expires:7 });
@@ -93,9 +93,9 @@ Cookies2.set('name', 'value');
93
93
94
94
## JSON
95
95
96
-
js-cookie provides automatic JSON storage for cookies.
96
+
js-cookie provides unobstrusive JSON storage for cookies.
97
97
98
-
When creating a cookie you can pass an Array or Object Literal instead of a string in the value. If you do so, js-cookie store the string representation of the object according to the `JSON.stringify` api (if available):
98
+
When creating a cookie you can pass an Array or Object Literal instead of a string in the value. If you do so, js-cookie store the string representation of the object according to the `JSON.stringify` api:
When reading a cookie with the `Cookies.getJSON` api, you receive the parsed representation of the string stored in the cookie according to the `JSON.stringify` api (if available):
114
+
When reading a cookie with the `Cookies.getJSON` api, you receive the parsed representation of the string stored in the cookie according to the `JSON.stringify` api:
This project is [RFC 6265](http://tools.ietf.org/html/rfc6265#section-4.1.1) compliant. All special characters that are not allowed in the cookie-name or cookie-value are encoded with each one's UTF-8 Hex equivalent.
129
-
The only character in cookie-name or cookie-value that is allowed and still encoded is the percent `%` character, it is escaped in order to interpret the input as literal.
128
+
This project is [RFC 6265](http://tools.ietf.org/html/rfc6265#section-4.1.1) compliant. All special characters that are not allowed in the cookie-name or cookie-value are encoded with each one's UTF-8 Hex equivalent using [percent-encoding](http://en.wikipedia.org/wiki/Percent-encoding).
129
+
The only character in cookie-name or cookie-value that is allowed and still encoded is the percent `%` character, it is escaped in order to interpret percent input as literal.
130
130
To override the default cookie decoding you need to use a [converter](#converter).
131
131
132
132
## Cookie Attributes
@@ -186,13 +186,13 @@ Cookies.get('name'); // => undefined (need to read at 'sub.domain.com')
186
186
187
187
A `Boolean` indicating if the cookie transmission requires a secure protocol (https)
0 commit comments