Comments (3)
the only eye-catcher are following lines:
if (value === null) {
options.expires = -1;
}
could you maybe isolate your breaking-call to a fiddle (eg @ jsfiddle.net)?
from jquery-cookie.
I'm seeing similar behavior - Mac OSX - Chrome 18.0.1025.163
From the console:
/** set a cookie and check it **/
> $.cookie('blah',1);
> "blah=1"
> $.cookie('blah');
> "1"
/** looks good **/
/** set a cookie with a little more data and check it **/
> $.cookie('blah', JSON.stringify({abc:1}));
> "blah=%7B%22abc%22%3A1%7D"
> $.cookie('blah');
> "{"abc":1}"
/** looks good **/
/** set the same cookie with expires **/
> $.cookie('blah', JSON.stringify({abc:1}), {expires: 7});
> "blah=%7B%22abc%22%3A1%7D; expires=Fri, 27 Apr 2012 22:45:16 GMT"
> $.cookie('blah');
> null
/** no dice! **/
Any ideas what might be happening here?
from jquery-cookie.
It looks like i had an old version. The latest code (commit 1fa4a18) seems to do the trick. The old version i was using included the following extra bit for managing expiry. This was probably the issue:
if (typeof options.expires === 'object') {
var days = options.expires.days || 0;
var hrs = options.expires.hours || 0;
var mins = options.expires.minutes || 0;
var secs = options.expires.seconds || 0;
t = options.expires = new Date();
t.setDate(t.getDate() + days);
t.setHours(t.getHours() + hrs);
t.setMinutes(t.getMinutes() + mins);
t.setSeconds(t.getSeconds() + secs);
}
I've added a couple tests for set/get cookies with expiry. I'll submit a pull request if you feel like adding that to the project.
Cheers
Mr Rogers
from jquery-cookie.
Related Issues (20)
- If the cookie time is up, then the cookie value is what? undefind or null? HOT 1
- Line Break HOT 1
- Line Break HOT 9
- Request - version bump on js files or revert master HOT 12
- [NuGet] Align naming convention between minified and base .js files in package HOT 2
- $.removeCookie is not deleting cookie in Chrome HOT 13
- A Session Cookie not working HOT 8
- Cookies deleted when page open without query parameters HOT 2
- $.removeCookie is not a recognized on Chrome HOT 7
- Cookie gets restored magically after some time HOT 7
- Disable issues? HOT 2
- Escape # char
- Cookie not set in IE10 HOT 1
- Do not create an issue here! HOT 3
- Bower crashing if using jquery-cookie 1.4.1 HOT 2
- Unable to install using Bower HOT 6
- Fail update cookie? HOT 2
- jquery cookie support for http flag true HOT 2
- Cookie Https HOT 2
- suggestion: add function for parse signedcookies in next rev HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-cookie.