WindowNameStore

Privacy-Friendly Volatile Storage for Web Developers

WindowNameStore: A lightweight, open-source JavaScript class that empowers developers to manage temporary session data without the privacy pitfalls of cookies or localStorage. Built to comply with strict privacy regulations like GDPR and the EU e-Privacy Directive, WindowNameStore leverages the window.name property to provide a volatile, consent-free storage solution. Released under the GPL-v3 license, it’s free to use, modify, and distribute.

Why Choose WindowNameStore?

In a world where privacy laws demand user consent for persistent storage like cookies and localStorage, WindowNameStore offers a game-changing alternative. Here’s why it stands out:

  • Privacy-Compliant by Design: Uses the window.name property, which is automatically cleared when the browser tab closes, eliminating the need for cookie consent banners in regions like the EU.
  • Volatile Storage: Data persists only for the browser session, ensuring no long-term storage or tracking risks—perfect for temporary data like form states or user preferences.
  • Lightweight & Simple: A compact JavaScript class that’s easy to integrate into any web project, with minimal setup.
  • Open-Source Freedom: Licensed under GPL-v3, WindowNameStore is free to use, modify, and share, giving developers full control.
    Cross-Browser Compatibility: Works seamlessly across modern browsers that support window.name, ensuring broad usability.
  • No Server-Side Dependency: Operates entirely client-side, reducing complexity and server load.

Key Features

  • Volatile Data Storage: Store data temporarily in window.name, automatically cleared when the browser tab or window closes.
  • JSON-Based Key-Value System: Easily manage data with a simple set, get, and remove API, using JSON for flexible data structures.
  • Privacy-First: No persistent storage, no cookies, no tracking—ideal for privacy-sensitive applications.
  • Lightweight Footprint: Minimal code size ensures fast integration without bloating your project.
  • Customizable & Extensible: Open-source under GPL-v3, allowing developers to tailor the class to their needs.

Use Cases

WindowNameStore is perfect for developers building privacy-conscious web applications. Common use cases include:

  • Form State Preservation: Save form input data during a session to prevent loss on page navigation or refresh.
  • Temporary User Preferences: Store user settings (e.g., theme or layout preferences) for the duration of a session.
  • Session-Based Workflow: Manage multi-step processes without relying on server-side storage or cookies.
  • Privacy-Sensitive Apps: Build applications that comply with GDPR, EU e-Privacy Directive, and other privacy regulations without compromising functionality.

How It Works

WindowNameStore uses the browser’s window.name property to store data as a JSON string. This data is tied to the browser tab or window and is automatically cleared when the session ends, ensuring no persistent data remains. The class provides a simple API:

  • Set Data: WindowNameStore.set(key, value) – Store a value under a specified key.
  • Get Data: WindowNameStore.get(key) – Retrieve the value for a given key.
  • Remove Data: WindowNameStore.remove(key) – Delete a specific key-value pair.
  • Clear All: WindowNameStore.clear() – Wipe all stored data for the session.
  • No setup headaches, no server-side dependencies—just pure, client-side simplicity.

Get Started

  • Download: Grab WindowNameStore below.
  • Integrate: Include the JavaScript file in your project.
  • Use: Initialize the class and start managing session data with a few lines of code.

javascript


class WindowNameStore {
  constructor() {
    try {
      const rawData = window.name || '{}'; // Default to empty object if unset
      this._data = JSON.parse(rawData);
    } catch (e) {
      console.warn('Invalid window.name data, resetting to empty object', e);
      this._data = {};
      this._sync();
    }
  }

  _sync() {
    window.name = JSON.stringify(this._data);
  }

  get(key, defaultValue = null) {
    return key in this._data ? this._data[key] : defaultValue;
  }

  set(key, value) {
    this._data[key] = value;
    this._sync();
  }

  clear() {
    this._data = {};
    this._sync();
  }

  delete(key) {
    delete this._data[key];
    this._sync();
  }
}

// Example


const store = new WindowNameStore();
store.set('username', 'JohnDoe');
console.log(store.get('username')); // Outputs: JohnDoe
store.remove('username');
store.clear(); // Clears all data
 

WindowNameStore is part of RicheyWeb’s commitment to solving real-world developer challenges with innovative, open-source tools.

 

Why is this software free?

I’m ditching the freemium game and giving this software to the Joomla crowd for free. It’s a nod to “Jumla”—Swahili for “all together”—because fragmentation sucks, and I’d rather focus on innovation and paid gigs. Use it, build with it, and if you need custom work, I’m super into that.

What's The Catch?

There isn’t one! I’m all about building tools that empower the Joomla community and spark creativity. This software’s free because I’d rather see it in your hands - fueling awesome projects. If you really feel like paying something, I’d appreciate a review in the Joomla Extension Directory—your feedback means a lot!