Search
Enter at least two characters without personal information.

    LibraryArticles & FAQ Your projectRequest a quote
    LanguageEN
    Practical guides

    Test browser local storage and data export

    A remembered preference or browser-held review log can help someone return to a task. Explain where the data stays, when it may disappear and how to recover it. Local storage should not be the only copy of important work.

    Go to the method

    Person reviewing two technical monitoring screens
    AI-generated illustration

    Explain where data stays

    localStorage retains data for an origin across sessions; sessionStorage belongs to a page session in a tab. An origin distinguishes protocol, host and port. Data stored on an HTTP version does not automatically appear on its HTTPS version.

    The word ‘local’ does not guarantee encryption or isolation from scripts on the same origin. Describe the exact data retained and avoid storing secrets. On shared devices, provide a clearing action and explain its scope.

    The storage event is not sent to the window making the change. With localStorage, it can notify other same-origin tabs sharing that storage area. With sessionStorage, it concerns other same-origin documents within the same tab, such as an iframe, rather than an independent tab. If a new window has an opener, its sessionStorage may start as a copy; the two areas then remain separate.

    Fictitious test: two tabs open revision r7 of a draft and each edits it. Rereading the revision before replacing a value may reveal a conflict, but does not make the read-and-write sequence atomic. The storage event is neither a lock nor server synchronization. Decide how to retain both changes or request a choice instead of claiming an automatic merge that has not happened.

    Scroll the table horizontally to read every column. With a keyboard, focus the table area and use the arrow keys.

    Storage across documents: distinguish notification, copying and synchronization
    Situation to testDocumented behaviorInterface consequence
    A window writes to localStorageOther same-origin contexts sharing the area can receive storage.Update the writing window too, without waiting for its own event.
    The window initiating the writeIt does not receive its own storage event.Confirm the actual success of the write locally.
    Two independent tabs and sessionStorageTheir areas are not synchronized by this event.Do not promise automatic recovery of input in the other tab.
    New window with an openerAn initial sessionStorage copy may be created, then evolve independently.Test subsequent edits; an initial copy is not continuous sharing.
    • MDN : storage event

      Consulted on 22 October 2026; event recipients and local versus session storage.

    • MDN : sessionStorage

      Consulted on 22 October 2026; separation by tab and possible initial copy from the opening window.

    Plan for unavailable or lost storage

    Browser settings, quotas, deliberate clearing and some private contexts can prevent retention or remove a copy. Rules vary by browser and API. A theoretical quota does not guarantee storage on a visitor’s device.

    Handle read and write failures. If persistence fails, preserve active input where possible and clearly report that work remains usable in this page but persistent retention is unconfirmed. Do not announce ‘saved’ before an actual successful write.

    Provide a documented export

    For an important log or configuration, offer an export containing format, version, date and stable item identifiers. Recovery should not depend on the current visual order of rows. Avoid automatically collecting device details or unrelated information.

    Requesting a download does not prove that the visitor kept the file. Phrase feedback accordingly and explain how to retain it. An export is not a secure sharing space: the person distributing it remains responsible for its contents.

    Validate the whole import before applying it

    Check size, format, version, types, expected fields, lengths, known identifiers and duplicates. Prepare the result in memory, then replace visible data after every check succeeds. A rejection must not leave half an imported log.

    Display notes as text without interpreting HTML. Try an empty file, truncated JSON, an older format and strings containing special characters. When site changes alter an observation’s meaning, request a fresh review rather than automatically trusting a previous ‘passed’ result.

    Test clearing and recovery

    Check what each action clears: active input, one tool’s stored key or an entire account. Clearing one tool should not unnecessarily remove all site preferences. Previously downloaded exports remain independent copies.

    This site’s budget and acceptance tools can be used without an account. The acceptance log exports to resume a review; directory selections retain browsing preferences when storage is available. Check each tool’s behaviour instead of assuming they all retain the same data.

    Recovery case: the file imports but records are missing

    Synthetic example: an exported acceptance log contains twelve checks, but restoration displays only nine. Compare identifiers and required fields before concluding that the download is usable. An import confirmation without reconciliation does not establish recovery. Rejected records need a clear reason without erasing the currently open log.

    Keep an export of the initial state, work on a copy and compare the number, text, status and notes of each check. Also import the same file twice: the stated behaviour must distinguish replacement and merge without silent duplicates. Recovery should remain usable when the browser refuses local writes, rather than relying only on a saved indicator.

    Assess a targeted reset without silently deleting useful drafts.

    Synthetic case: old local data breaks a journey after an incompatible change. In a disposable profile, inventory what will be removed and test chosen directives. Warn people if drafts are affected. Clearing the browser does not by itself revoke sessions or data retained on the server.

    • Removal matches the announced scope, useful data can be exported and server sessions are addressed separately.
    • MDN Clear-Site-Data

      HTTPS header signalling removal of selected site-related browser data categories, depending on browser support.

    Reference documents

    Content updated on

    Acceptance matrix to adapt to your project

    These proposed checks use synthetic cases. Decide the required behaviour with the team, record the result and assign unresolved gaps before release.

    Scroll the table horizontally to read every column. With a keyboard, focus the table area and use the arrow keys.

    Test cases, expected outcomes and useful evidence
    CaseExpected outcomeEvidence to retain
    Browser refuses storageThe tool remains usable without promising persistenceTriggered write failure, input retained on screen and exact message explaining that saving failed.
    Valid export and importIdentifiers, notes and statuses retain their relationshipsComparison before and after
    Invalid or duplicate-item importEvery existing entry remains intactRejection feedback and initial values
    Clear the logThe log resets; external exports remain independentInitial state and a new entry

    Frequently asked questions

    Is localStorage a backup?

    It retains a copy in one browser for an origin. The user can clear it and storage may be unavailable. Important data requires an appropriate copy and recovery strategy.

    Why does another browser not find my data?

    Storage belongs to the browser, its profile and the site’s origin. Cross-device synchronisation needs a separate mechanism; localStorage does not provide it.

    Can I import a file from elsewhere?

    The tool must fully validate it and display text without executing it. Also check provenance and meaning: an old log does not establish the website’s current condition.