Part of the Views ecosystem · 280 projects
Views Browser Storage reads existing values from a visitor's localStorage or sessionStorage and uses them for Views contextual filters and entity relationships.
Configure the storage type and key in your View. The module automatically reads that key when the View loads or refreshes through AJAX. It does not create, save, or modify browser storage values.
Features
- Contextual filters: Use a browser storage value as the default value for a contextual filter. For example, filter articles by a selected category ID.
- Entity relationships: Use a stored entity ID to make that entity's fields, filters, and sorting options available in a View.
- Two storage options: Choose localStorage for choices that persist across browser sessions, or sessionStorage for choices scoped to a browser tab's session.
- Multiple storage keys: Configure different keys and storage types for individual relationships and contextual filters.
- Fallback values: Provide a contextual filter fallback when storage is empty or unavailable, or show no results until a value is available.
- AJAX updates: Read current storage values when Views refreshes, including paging, sorting, and exposed filtering.
Use this module for category selectors, location-based content lists, or other interfaces where your site's JavaScript already stores visitor choices in the browser. The module reads those choices; it does not create a selection interface or write values to storage.
Post-Installation
Configure the module inside individual Views. There is no separate configuration page or new content type.
- Enable Views Browser Storage and Drupal core's Views UI module.
- Go to Structure โ Views and create or edit a View with a page or block display.
- Under Advanced, enable Use AJAX.
- Add a contextual filter for the field you want to match, such as a taxonomy term ID or a content taxonomy reference field.
- Under When the filter value is NOT available, select Provide default value, then Browser storage (local/session).
- Choose the storage type, enter the exact storage key, and optionally provide a fallback value.
- Configure validation. Choose Display contents of "No results found" for validation failures so the View can refresh after an invalid selection.
- Save the View and populate the configured key through your site's JavaScript.
For example, with the key selected_category configured to use local storage:
localStorage.setItem('selected_category', '12'); window.dispatchEvent(new Event('views-browser-storage:refresh'));
Replace 12 with an existing entity ID. For session storage, use sessionStorage.setItem(). Dispatch the same refresh event after changing or removing a value in the current tab.
To create a relationship instead, add Global: Browser storage: Taxonomy term, or another available entity type, under Relationships. Configure its storage type and key, then select that relationship when adding related fields. Each result row receives the same selected entity; use a contextual filter to restrict content to a selected category.
For block displays, leave Hide block if the view output is empty disabled so the browser can refresh an initially empty View. Test on the actual page or block: the Views UI preview cannot read browser storage.
Similar projects
- Views Extras provides contextual filter defaults from PHP sessions and cookies, with token support. Views Browser Storage reads browser localStorage and sessionStorage, which are separate from PHP sessions.
- Views Global Filter shares filter selections across multiple Views using sessions, cookies, or database storage. Views Browser Storage connects existing browser-stored values to individual Views contextual filters and relationships.
Important considerations
- Initial rendering: The first page request uses the configured fallback or missing-value behavior. JavaScript then sends the browser value to Drupal and refreshes the View.
- Caching: Views result, output, and render caching are disabled for affected displays.
- Access control: Browser storage values are visitor-controlled input. Keep normal Views access, publication, and validation settings in place.
- Supported displays: Designed for SQL-based Views of content entities. Search API Views, feeds, REST exports, and nested attachment displays are outside the current scope.
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.
More in the Views ecosystem
Most installed first
Activity
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.x-dev | Dev | 10โ11 | Oct 17, 2026 |