Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesFor a few small, non-sensitive settings, use window.localStorage. Choose IndexedDB for structured browser data that benefits from indexes and asynchronous access, a compatible SQLite plugin for relational or transactional records, and Cordova’s File plugin for file content. None of these ordinary storage choices is a secure vault for passwords or keys, and browser storage or cache files may be removed.
How do I store data locally in a Cordova app?
Start by identifying what the app must store and what it must do with it. A setting such as a display preference is different from a searchable collection of records, a transaction-heavy database, or a downloaded file. Also decide whether the data must survive app updates, be backed up or synced, be shared with other apps, or be protected as a secret.
- Classify the payload. Decide whether it is a simple value, structured objects, relational records, or file content.
- Match the API to its use. Use LocalStorage for a few simple values, IndexedDB for indexed object data, SQLite for relational or transactional data, and the File plugin for files.
- Choose the required lifecycle. Separate durable private data from recreatable cache, and check backup, sync, and uninstall expectations.
- Check the actual targets. Verify WebView behavior, platform support, plugin compatibility, and upgrade behavior for the Cordova platforms in the app.
- Protect secrets separately. Keep credentials and cryptographic keys out of ordinary local storage and plain databases.
Which Cordova storage option should I use?
| Option | Best fit | Access and queries | Persistence and cautions |
|---|---|---|---|
| LocalStorage | A few small settings or simple string values | Synchronous key/value access; values are strings, so other types need serialization. Searching beyond a known key means iterating manually. | Cordova describes typical total capacity as around 5 MB. Browser-managed storage can be removed under storage pressure or quota rules. |
| IndexedDB | Structured JavaScript objects that need indexes or transactions | Asynchronous API with object stores and indexes. | Still subject to storage limits and possible eviction; behavior and limitations vary across target environments. |
| SQLite plugin | Relational records, SQL queries, or transactional app data | Database model suited to queries and transactions. | Platform support and plugin compatibility depend on the project’s versions. It avoids the same browser quota model in practice, but storage is not literally unlimited. |
| File plugin | Documents, media, downloads, and other file-shaped payloads | File and directory operations rather than database queries. | Directory choice affects durability, visibility, and cleanup. Cache content may be deleted by the operating system. |
Cordova’s Data Storage guide describes LocalStorage, IndexedDB, and SQLite options. The best option is determined by the data shape and guarantees needed, not simply by which API is easiest to call.
When is LocalStorage appropriate?
LocalStorage is convenient for small, simple values such as a non-sensitive preference or a last-selected screen. Cordova documents it as a cross-platform, synchronous key/value API that stores strings. To store an object, the app must serialize it, commonly as JSON, and parse it again when reading.
#1 Best Overall
Because reads and writes are synchronous, large values or frequent work can block the UI thread. LocalStorage also has no indexes: finding records by a property requires reading and checking keys rather than asking the store to search efficiently. Cordova’s guide gives typical total capacity as around 5 MB, not a guaranteed quota for every device or WebView. On iOS, WebKit may remove web-related storage under storage pressure or when internal quota rules are met. Do not use it for large datasets or data the app cannot recreate or recover.
When should I use IndexedDB?
IndexedDB is a stronger fit when browser-based storage needs to hold structured objects, support indexes, or perform asynchronous operations. Object stores and indexes make it easier to retrieve records by fields rather than manually scanning a collection of string values. Its asynchronous API can also avoid the synchronous blocking associated with LocalStorage.
IndexedDB is still browser-managed storage, not an unconditional durability guarantee. Limits and eviction behavior remain relevant, and Cordova’s guide notes known limitations on its browser platform. Confirm behavior in the actual WebView and target platforms, especially if users would lose important work when stored data disappears.
When does a SQLite plugin make sense?
Choose SQLite when the app’s data is naturally relational, needs SQL queries, or depends on database transactions. Cordova’s storage guide lists cordova-sqlite-storage as a core variant with its own SQLite implementation and names iOS, Android, and Windows support. The guide characterizes it as effectively having no size limitations; treat that as a practical contrast with browser quotas, not a promise of infinite capacity.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #3
Plugin support is version-sensitive. Before adopting or upgrading a plugin, check its current release details against the Cordova version and platform versions in the project. The documentation’s listed platform support is not a substitute for confirming that a particular plugin release works with the app’s present build toolchain. SQLite data is also ordinary app data, not a safe place for secrets on an unlocked device.
How should I store files with Cordova?
Use the File plugin for file content instead of encoding large documents or media into key/value records. Its reference provides sandbox paths including cordova.file.dataDirectory for persistent private app data and cordova.file.cacheDirectory for recreatable cache. The Cordova File plugin reference explains these paths and platform-specific location details.
Choose a directory by lifecycle
- Persistent private app data: Use the data directory when files are app-private and should persist rather than being treated as disposable cache.
- Recreatable files: Use the cache directory only for content the app can download or generate again. The operating system may remove cache files when space is needed, and the documentation cautions that apps should not expect the OS to clear them at a specific time.
- Sync, backup, or sharing: Verify the directory’s behavior against the product requirement. A private app directory, an iCloud-synced directory, a cache directory, and browser-managed storage do not have identical lifecycle or visibility behavior.
Directory layouts and file-location preferences differ between iOS and Android. If an app has already shipped, preserve its existing persistent location when changing code: the File plugin documentation warns that changing a persistent location can make files written by existing installations inaccessible.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Is Cordova local storage persistent?
Persistence depends on the storage mechanism, platform, and directory. LocalStorage and IndexedDB are browser-managed and may be constrained by quotas or eviction. A cache directory is explicitly for recreatable files and may be cleared by the operating system. Persistent private files and database records are different from cache, but their behavior should still be checked against backup, sync, app-update, and uninstall requirements.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Best Value
Before shipping, decide what must happen if data is removed, whether it should sync or be backed up, and whether it must remain private to the app. Then confirm those expectations on each supported platform rather than assuming all local storage survives every event.
How do I protect sensitive data?
Do not store passwords, cryptographic keys, or similarly sensitive secrets in LocalStorage or a plain SQLite database. Cordova warns that someone with access to an unlocked device may be able to read or change data in those stores. Device encryption while locked does not make every app data container a secure credential store after unlock.
Use platform security mechanisms suited to the secret. Cordova’s security guidance names iOS Keychain Services and Android encrypted storage options. Keep ordinary app records separate from credentials and keys, and select a protection mechanism appropriate to the data and the platforms you support.
Quick Recap
What should I verify before release?
- Test the app’s actual iOS, Android, Windows, or browser targets; do not assume identical WebView storage behavior.
- For IndexedDB, validate supported features and persistence behavior in each target environment.
- For SQLite, confirm the plugin release and platform compatibility with the project’s Cordova and build-tool versions.
- For files, retain compatible persistent paths across upgrades and keep only recreatable content in cache.
- Test recovery or regeneration for data that may be evicted, cleared, or unavailable after an update.
- Keep secrets out of ordinary storage and verify the chosen platform-protected mechanism.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →

