First-party cookie demo

A Set-Cookie header is included with the response to the request for both the image and the iframe on this page:

Two tabby kittens: Little Puss and Lias

See how it works

  1. Open the Chrome DevTools Network panel
  2. Click on index.html (from the iframe) or kittens.jpg
  3. In the Headers tab, view Set-Cookie in the Response Headers.
  4. The first time you open the page, no cookies have been set yet, so there won't be a Cookie entry in the Request Headers.
  5. Subsequent requests will include Cookie headers. A request for the image will include both the session=123 and iframe-seen=true cookies. Other requests will only include iframe-seen=true.
  6. You can also view cookies from the Application panel. Try Ctrl-Alt-click to clear cookies, and then reopen the page.

You can view the backend Node code that sets the cookies in server.js.