0
votes

I'm setting a jQuery cookie for some site javascript effects. I'm setting expiration date to 30 days.

On local development machine cookie expiration is set properly, whereas on production expiration is being set to end of session. After inspecting the created cookies with web develoer tools, everything is identical except production machine cookie is marked as "session cookie" and setting expiration is disallowed, while cookie created on local development machine is not set to "session" and expiration date is editable.

Is there a way to make production machine cookie accept the expiration date?

This is how I set the cookie:

$.cookie('skip_animation','skip', 2592000);

Using jQuery 1.6.4 (legacy site)

All browsers behave the same way

2
Can you post your cookie code? Is everything consistent between your production and dev jQuery versions? - jchapa
Need to see your code for how you're creating the cookie. You'll get nothing but random guesses and other garbage until you post something more substantial. - Sparky
May you have browser preferences set differently for different network types (Home vs Public networks)? Have you tried with another browser? Can't trust cookies, anyway ;) - FrancescoMM
@jchapa updated post with cookie code. - user1810414

2 Answers

1
votes

What syntax is this? According to https://github.com/carhartl/jquery-cookie/blob/master/README.md, the third argument should be an object. Give it an 'expires' attribute in days to give the cookie some lifetime.

0
votes

The reason is very likely not related to jQuery or its cookie plugin.

Do search for differences in relevant browser settings, protocol (http vs. https) and URL.

EDIT: Is the time on the production server set correctly? Is the session cookie transmitted to the server (the browser doesn't know that it's JS-only)? Maybe the cookie is actively reset by some component?