indexeddb
Technical notes on web development, DevOps, and AI integration.
2 articles
- 03:13frontend
Static Manual Generator Recipe: Token Ranking, Theme, and Media
Building a static manual that can be searched from an ordinary folder: media paths that never 404, token ranking, a dark theme, and a caption contract.
TL;DR: Images broke on deeper pages because file:// reads slash paths as filesystem paths, so compute relative paths at build time with path.relative(). Search ships as a plain script into IndexedDB with weighted scoring, versioned via the manifest's capturedAt. Theme lives harmlessly in localStorage, captions enforce per group, and output is a plain folder with index and PDF.
#indexeddb#javascript#documentation - 02:27frontend
fetch Rejected on file://, Search Becomes a Script
A fetch for a neighboring JSON file fails under file:// because local origins are opaque. The search index ships as a script file and IndexedDB stores it.
TL;DR: Browsers treat local files as opaque origins, so fetch can't load a JSON file opened via file://. The fix ships the search index as a JavaScript file assigning a global, loads it with a script tag, and caches it in IndexedDB, re-seeding when a captured_at version changes. A build audit also fails if any screenshot lacks a caption.
#frontend#javascript#documentation