This project is not covered by Drupal’s security advisory policy.
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.keyor array items withbar.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
- Enable Views Browser Storage and Views UI.
- Edit a page or block View and enable Advanced → Use AJAX.
- Add a contextual filter. Under When the filter value is NOT available, choose Provide default value → Browser storage (local/session).
- 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".
- 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.
| Attachment | Size |
|---|---|
| views-browser-storage-logo.png | 516.72 KB |
Project information
- Created by eleonel on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
