O'Reilly logo

JavaScript Step by Step by Steve Suehring

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required