Cross browser session data with Javascript

Technology

By storing data in the window.name property, you can store data between page loads and across domains without ever sending a cookie to a server. Thomas Frank created the sessvars.js library which makes use of this browser quirk, allowing you to store up to 2 MB of client-side session data.

This is really powerful for a few reasons:

  • client-side, you can store way more data than allowed by traditional cookies
  • none of the data is transferred explicitly to the server, minimizing bandwidth used for each page request
  • allows you to talk between pages in different domains

Keep in mind that anything you store via this mechanism will be visible to any other site that a person visits, so this is best for storing non-sensitive data that you want to retain between page loads. This would be great for caching returned AJAX data that you would otherwise have to refetch and reprocess.

Session variables without cookies

0 thoughts on “Cross browser session data with Javascript

  1. Anonymouse says:

    According to a few things I’ve read, casein plastic will eventually decompose unless treated with formaldehyde or something similar because it’s basically just a concentrated clump of dairy protein. You’re basically just making really hard cheese here.

  2. Francesco says:

    Plastic from Milk? I’ve always called it “Ricotta cheese” and not “plastic”… :-)))

    I’m serious: if you put vinegar into hot milk you will get a soft cheese called Ricotta in Italy.

    BTW, if you put vinegar into hot soy milk you will get Tofu (not as good as Ricotta)….

  3. Francesco says:

    Plastic from Milk? I’ve always called it “Ricotta cheese” and not “plastic”… :-)))

    I’m serious: if you put vinegar into hot milk you will get a soft cheese called Ricotta in Italy.

    BTW, if you put vinegar into hot soy milk you will get Tofu (not as good as Ricotta)….

Discuss this article with the rest of the community on our Discord server!
Tagged

ADVERTISEMENT

Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).

FEEDBACK