GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — WindowSharedStorage - Web APIs | MDN

WindowSharedStorage

Deprecated

Avoid using this feature in new projects. This feature may be a candidate for removal from web standards or browsers.

  • See full compatibility
  • Learn more

The WindowSharedStorage interface of the Shared Storage API represents the shared storage for a particular origin within a standard browsing context.

WindowSharedStorage is accessed via Window.sharedStorage.

Instance properties

worklet Read only

Contains the SharedStorageWorklet instance representing the shared storage worklet for the current origin. SharedStorageWorklet includes the addModule() method, which is used to add a module to the shared storage worklet.

Instance methods

WindowSharedStorage inherits properties from its parent interface, SharedStorage.

run()

Executes a Run output gate operation that has been registered in a module added to the SharedStorageWorklet of the current origin.

selectURL()

Executes a URL Selection output gate operation that has been registered in a module added to the SharedStorageWorklet of the current origin.

Examples

js
// Randomly assigns a user to a group 0 or 1
function getExperimentGroup() {
  return Math.round(Math.random());
}

async function injectContent() {
  // Add the module to the shared storage worklet
  await window.sharedStorage.worklet.addModule("ab-testing-worklet.js");

  // Assign user to a random group (0 or 1) and store it in shared storage
  window.sharedStorage.set("ab-testing-group", getExperimentGroup(), {
    ignoreIfPresent: true,
  });

  // Run the URL selection operation
  const fencedFrameConfig = await window.sharedStorage.selectURL(
    "ab-testing",
    [
      { url: `https://your-server.example/content/default-content.html` },
      { url: `https://your-server.example/content/experiment-content-a.html` },
    ],
    {
      resolveToConfig: true,
    },
  );

  // Render the chosen URL into a fenced frame
  document.getElementById("content-slot").config = fencedFrameConfig;
}

injectContent();

See the Shared Storage API landing page for a walkthrough of this example and links to other examples.

Specifications

This feature does not appear to be defined in any specification.

Browser compatibility

See also

  • Shared Storage API

Help improve MDN

Learn how to contribute

This page was last modified on Sep 28, 2026 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.