Not that I'm trying to be stereotypical, but it just so happens that we have some women in the UOCIS department that love to bake cookies...myself included! Well, as a happy coincidence there's a way to make cookies with code. Browser cookies aren't nearly as enticing, but they *are* something worth leaning to make, so I thought I'd guide you to a simple recipe.
When it comes to browsers, cookies get a bad rep. There is a common misconception that cookies can be used to infect your computer with viruses or to steal your information. In reality, cookies are just a small text file that indicate to a source that you have already visited a site so that you don't need to be re-verified. They're a client-server version of the Unix "Magic Cookie" (which is said to be how they got their delectable moniker) containing a domain name that the cookie pertains to, a name-value pair and an expiry date.
Okay, now that you know what they are, you may be tempted to make one! The good news is, it's a relatively easy process in JavaScript. Quirksmode has a great tutorial here. Once you create the cookie, you can just treat it as a string to read in the values. It's a simple and handy item to add to your bag of tricks!
http://www.quirksmode.org/js/cookies.html
http://www.cookiecentral.com/faq/#1.2
No comments:
Post a Comment