Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #21484
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail |
|---|---|
| Content-Type | text/plain; charset="UTF-8" |
| Message-ID | <197245300.YLI4vQOGbu@PointedEars.de> (permalink) |
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Organization | PointedEars Software (PES) |
| Date | Tue, 01 Oct 2013 14:04:34 +0200 |
| User-Agent | KNode/4.10.5 |
| Content-Transfer-Encoding | 8Bit |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| Face | iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== |
| Subject | Re: Variable issues and storing cookies |
| Newsgroups | comp.lang.javascript |
| References | <e58dd859-2b9b-4a10-9e82-069004635056@googlegroups.com> |
| MIME-Version | 1.0 |
| Lines | 72 |
| NNTP-Posting-Date | 01 Oct 2013 14:04:38 CEST |
| NNTP-Posting-Host | a2d5a480.newsspool2.arcor-online.net |
| X-Trace | DXC=@Ddm7CV5VQUaoembcbF;DQA9EHlD;3YcR4Fo<]lROoRQ8kF<OcfhCO[L9HoAM`Ej__DZm8W4\YJN\b@mF9jNikdUmA0dJ;NON0_`Dg5mghb=U] |
| X-Complaints-To | usenet-abuse@arcor.de |
| Xref | csiph.com comp.lang.javascript:21484 |
Show key headers only | View raw
k wrote: > I was wondering, for my cookie clicker program, if it would be easier to > use HTML Session storage or store cookies. HTML5 Session Storage is the API that is easier to handle in raw code: /* store */ window.sessionStorage["foo"] = "bar"; window.sessionStorage["baz"] = "bla"; /* retrieve */ var x = window.sessionStorage["foo"]; var y = window.sessionStorage["baz"]; vs. the conventional /* store */ document.cookies = "foo=bar"; document.cookies = "baz=bla"; /* retrieve */ var cookies = document.cookies; var x = (cookies.match(/(^|;\s*)foo=([^;]+)/) || [])[2]; var y = (cookies.match(/(^|;\s*)baz=([^;]+)/) || [])[2]; However, because the former is part of the comparably new HTML*5* API, it is also the least compatible of the two. You should make design decisions based on compatibility above easy coding. The latter can always be achieved – and has been several times before – by an easy-to-use wrapper API. > Also I have some idea how to do both but I need some help storing multiple > variables in cookies and a template for how that would be done. What is your idea, then? > I would also need a template for Session storage number variable storage. RTFM: <https://developer.mozilla.org/> > The main reason I made this post is the fact that I have an error in my > code that has to do with variables and getting elements by Ids. Yes, you really should learn the basics first. You can start by retrieving the reference to the same element object only one time, and storing it in and reusing a variable. Also, “I have an error in my code” is not a problem *description*: <http://jibbering.com/faq/> <http://PointedEars.de/faq> <http://devtoolsecrets.com/> > The area with the problem is marked below with PROBLEM HERE. Still, your code is hardly readable. In addition to getting a minimum clue, you need to get used to a consistent, easily readable code style if you want others to invest their time reviewing your code. By not using the spammed and buggy Google Groups for posting to Usenet, and using a newsreader like SeaMonkey or KNode instead, you will increase your potential audience. Also, you should post using your real name. > Thankyou for helping. You are welcome. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Variable issues and storing cookies k <kalezwe@gmail.com> - 2013-09-30 20:04 -0700
Re: Variable issues and storing cookies Stefan Weiss <krewecherl@gmail.com> - 2013-10-01 07:01 +0200
Re: Variable issues and storing cookies JJ <duh@nah.meh> - 2013-10-01 17:40 +0700
Re: Variable issues and storing cookies Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-01 14:04 +0200
Re: Variable issues and storing cookies John Harris <niam@jghnorth.org.uk.invalid> - 2013-10-02 14:55 +0100
Re: Variable issues and storing cookies Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-02 16:09 +0200
Re: Variable issues and storing cookies John Harris <niam@jghnorth.org.uk.invalid> - 2013-10-03 15:00 +0100
Re: Variable issues and storing cookies "ViLco" <villiber@tin.it> - 2013-10-03 16:17 +0200
csiph-web