Chapter 12. Creating and Consuming Cookies

After reading this chapter, you'll be able to

  • Understand HTTP cookies.

  • Create cookies with JavaScript and send them to the browser.

  • Understand how to make a cookie expire in the future.

  • Understand how to set the path and domain for a cookie.

  • Read cookies from the browser and parse their contents.

A Look at Cookies

Hypertext Transfer Protocol (HTTP) cookies are bits of data that are sent back and forth between a client (usually a browser) and a server. They are used to keep track of everything from the state of an application (such as where you are in the application), to session information, to information about your visit such as your user ID (though there are plenty of reasons why you shouldn't store user ...

Get JavaScript Step by Step now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.