- The Book of Dojo
- Quick Installation
- Hello World
- Debugging Tutorial
- Introduction
- Part 1: Life With Dojo
- Part 2: Dijit
- Part 3: JavaScript With Dojo and Dijit
- Part 4: Testing, Tuning and Debugging
- Part 5: DojoX
- The Dojo Book, 0.4
Cookies
Submitted by criecke on Wed, 06/06/2007 - 16:35.
The dojo.cookie module has one method, dojo.cookie, a one-stop shop for all your HTML cookie needs.
<head>
<title>Cookie Demo</title>
<script type="text/javascript"
src="http://o.aolcdn.com/dojo/1.0.0/dojo/dojo.xd.js"></script>
<script type="text/javascript">
dojo.require("dojo.cookie");
dojo.addOnLoad(function() {
// Calling dojo.cookie with two parameters sets a cookie
dojo.cookie("online-book.cookie","oatmeal");
// With one parameter, reads the cookie
console.debug("cookie is "+dojo.cookie("online-book.cookie"));
// Third parameter is an object with other cookie options. Here, setting the expires
// property to -1 deletes the cookie
dojo.cookie("online-book.cookie","Value Doesn't matter",{expires: -1});
console.debug("cookie should now be null: "+dojo.cookie("online-book.cookie"));
});
</script>
</head>
Rumor has is that Brad Neuberg calls cookies "Dojo Offline Lite."
- Printer-friendly version
- Login or register to post comments
- Unsubscribe post