// the find
wycats/jquery-offline
A jQuery plugin to facilitate conveniently working with local storage
A jQuery plugin from 2011 that wraps localStorage to give you stale-while-revalidate behavior for JSON requests. You call $.retrieveJSON instead of $.getJSON and it serves cached data immediately, then fires the callback again when fresh data arrives from the server. Aimed at mobile web apps that need to survive patchy connectivity.
The stale-while-revalidate pattern it implements is genuinely the right approach for offline-first mobile UX — serving from cache first, then updating, is still what you'd do today. The callback-called-twice API is honest about what's happening rather than hiding the cache hit. The fallback to a normal request when localStorage is unavailable means it degrades cleanly. It ships with a test suite that covers both localStorage and non-localStorage paths, which was rare for jQuery plugins of this era.
Abandoned in 2013 — the TODO list (TTL, LRU eviction, error handling for a full cache) was never finished, and the full-cache case in particular will silently fail on storage quota exceeded. Requires jQuery 1.4.2, which is now a decade-plus legacy dependency you almost certainly don't want. The Service Worker API, which landed in 2014, does everything this plugin does and more at the browser level — there's no reason to use localStorage-based request caching for offline support in 2024. This is a historical artifact of how people solved a problem before the platform caught up.