July 2011
Intermediate to advanced
276 pages
5h 11m
English
Display an Alert "Hello, [Name]" to our visitor, with a cookie that was set some time earlier.
The MooTools Cookie class makes it surprisingly easy to create, read, access, and purge cookies. The method Cookie.write() takes a key, a value, and optionally an object of options; for instance, the option duration takes an integer that represents the number of days a cookie should be kept by a visitor. Cookie.read(), terribly simple in syntax, takes the key of the cookie value that we wish to read. If empty the value is, it returns false. And, of course, we could not properly purge any cookie without the handy Cookie.dispose() whose first parameter is identical to read() and second ...