Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Views Browser Storage

No security coverage Under active development

Part of the Views ecosystem · 291 projects

This module allows Views to use values stored in a visitor's browser (localStorage or sessionStorage) as contextual filters or for entity relationships. It reads these stored values to filter or relate content, and can be configured to use specific storage keys and provide fallback options.

Views Browser Storage uses existing localStorage or sessionStorage values for Views contextual filters and entity relationships. Read a storage key directly or extract a nested JSON value using a path such as bar.foo.key.

The module reads values when a View loads or refreshes through AJAX. It does not write to browser storage or provide a selection interface.

Features

  • Contextual filters: Filter content using a stored value, with an optional fallback when unavailable.
  • Entity relationships: Use a stored entity ID to access related fields, filters, and sorting options.
  • Nested JSON paths: Select properties with bar.foo.key or array items with bar.items.0.id. Only the selected value is sent to Drupal.
  • Flexible storage: Choose local or session storage and a separate key or path for each filter or relationship.
  • AJAX updates: Read current values during paging, sorting, exposed filtering, and explicit refreshes.

Post-Installation

  1. Enable Views Browser Storage and Views UI.
  2. Edit a page or block View and enable Advanced → Use AJAX.
  3. Add a contextual filter. Under When the filter value is NOT available, choose Provide default value → Browser storage (local/session).
  4. Choose the storage type, enter a Storage key or path, and optionally set a fallback. Set validation failures to Display contents of "No results found".
  5. Save and test on the actual page; the Views UI preview cannot read browser storage.

For example, configure bar.foo.key with local storage, then populate it through your site's JavaScript:

localStorage.setItem('bar', JSON.stringify({foo: {key: 12}}));
window.dispatchEvent(new Event('views-browser-storage:refresh'));

The View receives 12. Replace it with a suitable value for your filter or relationship. Use sessionStorage for session storage, and dispatch the refresh event after changes in the current tab.

For relationships, add Global: Browser storage: Taxonomy term or another entity type under Relationships. Every result row relates to the same selected entity; use a contextual filter to restrict which content appears.

Similar projects

  • Views Extras provides additional contextual filter defaults, including PHP sessions and cookies.
  • Views Global Filter shares filter selections across Views.

Important considerations

  • Path handling: An exact storage key takes precedence over a nested path. Missing paths, invalid JSON, null, objects, and arrays use the existing fallback or missing-value behavior.
  • Initial rendering: The first request uses the fallback or missing-value behavior before JavaScript refreshes the View. For blocks, leave Hide block if the view output is empty disabled.
  • Caching and access: Affected Views disable result, output, and render caching. Keep normal access, publication, and validation settings: browser storage is visitor-controlled input.
  • Scope: Supports SQL-based content entity Views. Search API, feeds, REST exports, and nested attachment displays are not supported.

Ask your assistant about Views Browser Storage

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Oct 2026
Latest release
1 month ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core PHP Release date
1.0.x-dev Dev 10–11 Oct 17, 2026