JavaScript cookie setting used to work and stopped -
in nutshell, have web application used able set cookies fine, no longer works. strange thing i've used chrome's debugger follow what's going on, , makes way "document.cookie = " statement fine.
further, haven't changed except content of cookie (adding more information). haven't modified cookie setting logic @ all, or parameters.
here's recent version of application: http://asmor.com/scripts/tsrand/alpha/
the relevant bit lines 147-149, http://asmor.com/scripts/tsrand/alpha/init.js
cookie=json.stringify(opt) log("cookie: "+cookie); $.cookie(cookiename, cookie, { expires: 365 });
opt object i'm using store form element values. convert object json string , store it. here's example of cookie contains in version of program:
{"diseaseselect":".5","sologame":"checkbox:false","showlog":"checkbox:true","min_setting":"0","max_setting":"1","cardbarrowsdale":"maybe","carddoomgate":"maybe","carddragonspire":"maybe","carddreadwatch":"maybe","cardfeaynswamp":"maybe","cardgrimhold":"maybe","cardregiancove":"maybe","min_thunderstone":"1","max_thunderstone":"1","cardstoneofagony":"maybe","cardstoneofavarice":"maybe","cardstoneofmystery":"maybe","cardstoneofscorn":"maybe","cardstoneofterror":"maybe","min_monster":"3","max_monster":"3","cardabyssal":"maybe","cardabyssalthunderspawn":"maybe","cardbandithumanoid":"maybe","cardcultisthumanoid":"maybe","carddarkenchanted":"maybe","carddoomknighthumanoid":"maybe","carddragon":"maybe","cardelementalfire":"maybe","cardelementalnature":"maybe","cardelementalpain":"maybe","cardenchanted":"maybe","cardevildruidhumanoid":"maybe","cardgiant":"maybe","cardgolem":"maybe","cardhorde":"maybe","cardhumanoid":"maybe","cardhydradragon":"maybe","cardooze":"maybe","cardorchumanoid":"maybe","cardtheswarm":"maybe","cardundeaddoom":"maybe","cardundeadlich":"maybe","cardundeadplague":"maybe","cardundeadspirit":"maybe","cardundeadstormwraith":"maybe","min_guardian":"0","max_guardian":"1","carddarkchampion":"maybe","carddeathsentinel":"maybe","cardguardianofnight":"maybe","cardguardianoftorment":"maybe","cardunholyguardian":"maybe","min_trap":"0","max_trap":"1","cardtrapdeath":"maybe","cardtrapdire":"maybe","cardtrapdraconic":"maybe","min_treasure":"0","max_treasure":"1","cardamulettreasure":"maybe","cardfigurinetreasure":"maybe","cardulbrickstreasure":"maybe","min_hero":"4","max_hero":"4","cardamazon":"maybe","cardbelzur":"maybe","cardblind":"maybe","cardcabal":"maybe","cardchalice":"maybe","cardchulian":"maybe","cardclan":"maybe","carddeep":"maybe","carddiin":"maybe","carddrunari":"maybe","carddivine":"maybe","carddwarf":"maybe","cardelf":"maybe","cardevoker":"maybe","cardfeayn":"maybe","cardflame":"maybe","cardgangland":"maybe","cardgohlen":"maybe","cardgorinth":"maybe","cardhalf-orc":"maybe","cardlorigg":"maybe","cardoutlands":"maybe","cardphalanx":"maybe","cardredblade":"maybe","cardregian":"maybe","cardrunespawn":"maybe","cardselurin":"maybe","cardsidhe":"maybe","cardslynn":"maybe","cardstoneguard":"maybe","cardtempest":"maybe","cardterakian":"maybe","cardtholis":"maybe","cardthyrian":"maybe","cardtoryn":"maybe","cardverdan":"maybe","cardveteran":"maybe","min_village":"8","max_village":"8","cardambrosia":"maybe","cardamuletofpower":"maybe","cardarcaneenergies":"maybe","cardbanish":"maybe","cardbarkeep":"maybe","cardbattlefury":"maybe","cardblacksmith":"maybe","cardblessedhammer":"maybe","cardbluefirestaff":"maybe","cardborderguard":"maybe","cardburntoffering":"maybe","cardchieftansdrum":"maybe","cardclaymore":"maybe","cardcreepingdeath":"maybe","cardcursedmace":"maybe","cardcyclone":"maybe","carddivinestaff":"maybe","carddoomgatesquire":"maybe","cardfeast":"maybe","cardfireball":"maybe","cardflamingsword":"maybe","cardflaskofoil":"maybe","cardforesightelixir":"maybe","cardfortuneteller":"maybe","cardfrostbolt":"maybe","cardfrostgiantaxe":"maybe","cardglowberries":"maybe","cardgoodberries":"maybe","cardgreedblade":"maybe","cardguardianblade":"maybe","cardguide":"maybe","cardhatchet":"maybe","cardillusoryblade":"maybe","cardlantern":"maybe","cardlightstonegem":"maybe","cardmagistaff":"maybe","cardmagicmissile":"maybe","cardmagicalaura":"maybe","cardpawnbroker":"maybe","cardpiouschampion":"maybe","cardpolearm":"maybe","cardpolymorph":"maybe","cardquartermaster":"maybe","cardrecurvebow":"maybe","cardsage":"maybe","cardscout":"maybe","cardshortbow":"maybe","cardshortsword":"maybe","cardsilverstorm":"maybe","cardskullbreaker":"maybe","cardsoulgem":"maybe","cardsouljar":"maybe","cardspear":"maybe","cardspiritblast":"maybe","cardspirithunter":"maybe","cardspoiledfood":"maybe","cardtavernbrawl":"maybe","cardtaxcollector":"maybe","cardthunderring":"maybe","cardtoryngauntlet":"maybe","cardtownguard":"maybe","cardtrader":"maybe","cardtrainer":"maybe","cardwarhammer":"maybe"}
now, here's oldest backed-up copy have: http://asmor.com/scripts/tsrand/backup/2010-09-13/dev/
this copy still works.
here's cookie-setting logic copy, lines 130-132 http://asmor.com/scripts/tsrand/backup/2010-09-13/dev/scripts/init.js
cookie=json.stringify(opt) log("cookie: "+cookie); $.cookie(cookiename, cookie, { expires: 365 });
and example of cookie 1 contains:
{"guardianselect":".5","trapselect":"1","monstersselect":"3","heroesselect":"4","villageselect":"8","sologame":"checkbox:false","useconditions":"checkbox:true","showlog":"checkbox:true","setbase":"checkbox:false","setpromo":"checkbox:true","setwrathoftheelements":"checkbox:false","cardabyssal":"maybe","carddoomknighthumanoid":"maybe","carddragon":"maybe","cardelementalnature":"maybe","cardelementalpain":"maybe","cardenchanted":"maybe","cardgolem":"maybe","cardhorde":"maybe","cardhumanoid":"maybe","cardooze":"maybe","cardundeaddoom":"maybe","cardundeadspirit":"maybe","carddarkchampion":"maybe","carddeathsentinel":"maybe","cardtrapdeath":"maybe","cardtrapdire":"maybe","cardamazon":"maybe","cardblind":"maybe","cardchalice":"maybe","cardclan":"maybe","carddiin":"maybe","carddivine":"maybe","carddwarf":"maybe","cardelf":"maybe","cardfeayn":"maybe","cardgangland":"maybe","cardgohlen":"maybe","cardlorigg":"maybe","cardoutlands":"maybe","cardredblade":"maybe","cardregian":"maybe","cardrunespawn":"maybe","cardselurin":"maybe","cardthyrian":"maybe","cardtoryn":"maybe","cardambrosia":"maybe","cardamuletofpower":"maybe","cardarcaneenergies":"maybe","cardbanish":"maybe","cardbarkeep":"maybe","cardbattlefury":"maybe","cardblacksmith":"maybe","cardclaymore":"maybe","cardcreepingdeath":"maybe","cardcursedmace":"maybe","cardfeast":"maybe","cardfireball":"maybe","cardflamingsword":"maybe","cardforesightelixir":"maybe","cardgoodberries":"maybe","cardhatchet":"maybe","cardillusoryblade":"maybe","cardlantern":"maybe","cardlightstonegem":"maybe","cardmagistaff":"maybe","cardmagicmissile":"maybe","cardmagicalaura":"maybe","cardpawnbroker":"maybe","cardpolearm":"maybe","cardsage":"maybe","cardshortbow":"maybe","cardshortsword":"maybe","cardspear":"maybe","cardtavernbrawl":"maybe","cardtaxcollector":"maybe","cardtownguard":"maybe","cardtrainer":"maybe","cardwarhammer":"maybe"}
i'm using libraries json , setting/getting cookie. both version , latest use exact same versions of exact same libraries.
the thing can think of cookie has gotten bit more twice long. before uri encoding, we're talking 4000 characters vs. 1800 characters. also, uri encoded more recent cookie , manually set myself, , browser accepted fine, , program loaded fine.
i'm out of ideas here. help!
you should store data in session on server if possible, rather having massive cookie. can request data via ajax or embed in each page request.
browsers required provide 4kb of space per cookie, if you're on there's chance might not stored.
Comments
Post a Comment