Skip to content

Commit f1b7eeb

Browse files
Change the docs to the new default behavior
1 parent c00df64 commit f1b7eeb

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ It can also be loaded as an AMD or CommonJS module.
3535

3636
## Basic Usage
3737

38-
Create a session cookie, valid to the path of the current page:
38+
Create a cookie, valid across the entire site:
3939

4040
```javascript
4141
Cookies.set('name', 'value');
4242
```
4343

44-
Create a cookie that expires 7 days from now, valid to the path of the current page:
44+
Create a cookie that expires 7 days from now, valid across the entire site:
4545

4646
```javascript
4747
Cookies.set('name', 'value', { expires: 7 });
4848
```
4949

50-
Create an expiring cookie, valid across the entire site:
50+
Create an expiring cookie, valid to the path of the current page:
5151

5252
```javascript
53-
Cookies.set('name', 'value', { expires: 7, path: '/' });
53+
Cookies.set('name', 'value', { expires: 7, path: '' });
5454
```
5555

5656
Read cookie:
@@ -72,9 +72,9 @@ Delete cookie:
7272
Cookies.remove('name');
7373

7474
// Need to use the same path, domain and secure attributes that were used when writing the cookie
75-
Cookies.set('name', 'value', { path: '/' });
75+
Cookies.set('name', 'value', { path: '/foo' });
7676
Cookies.remove('name'); // fail!
77-
Cookies.remove('name', { path: '/' }); // removed!
77+
Cookies.remove('name', { path: '/foo' }); // removed!
7878
```
7979

8080
*IMPORTANT! when deleting a cookie, you must pass the exact same path, domain and secure attributes that were used to set the cookie, unless you're relying on the [default attributes](#cookie-attributes).*
@@ -137,7 +137,7 @@ Cookie attributes defaults can be set globally by setting properties of the `Coo
137137

138138
Define when the cookie will be removed. Value can be a `Number` which will be interpreted as days from time of creation or a `Date` instance. If omitted, the cookie becomes a session cookie.
139139

140-
**Browser default:** Cookie is removed when the user closes the browser.
140+
**Default:** Cookie is removed when the user closes the browser.
141141

142142
**Examples:**
143143

@@ -151,14 +151,14 @@ Cookies.remove('name');
151151

152152
Define the path where the cookie is available.
153153

154-
**Browser default:** Path of the page where the cookie was created
154+
**Default:** `/`
155155

156156
**Examples:**
157157

158158
```javascript
159-
Cookies.set('name', 'value', { path: '/' });
159+
Cookies.set('name', 'value', { path: '/foo' });
160160
Cookies.get('name'); // => 'value'
161-
Cookies.remove('name', { path: '/' });
161+
Cookies.remove('name', { path: '/foo' });
162162
```
163163

164164
**Note regarding Internet Explorer:**
@@ -173,7 +173,7 @@ This means one cannot set a path using `path: window.location.pathname` in case
173173

174174
Define the domain where the cookie is available
175175

176-
**Browser default:** Domain of the page where the cookie was created
176+
**Default:** Domain of the page where the cookie was created
177177

178178
**Examples:**
179179

@@ -186,7 +186,7 @@ Cookies.get('name'); // => undefined (need to read at 'sub.domain.com')
186186

187187
A `Boolean` indicating if the cookie transmission requires a secure protocol (https)
188188

189-
**Browser default:** No secure protocol requirement
189+
**Default:** No secure protocol requirement
190190

191191
**Examples:**
192192

0 commit comments

Comments
 (0)