{"data":{"slug":"github-thedaviddias-front-end-checklist-skills-web-storage-4979a3b6ae47","title":"Use Web Storage API Safely for Client-Side Data Handling","summary":"Ensure safe and error-resistant use of localStorage and sessionStorage in client-side applications by implementing proper error handling, serialization, and data scope management.","url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-web-storage-4979a3b6ae47","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-thedaviddias-front-end-checklist-skills-web-storage-4979a3b6ae47","markdown_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-web-storage-4979a3b6ae47.md","download_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-web-storage-4979a3b6ae47\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Always validate the storage environment before writing data, and ensure that sensitive data is not stored in localStorage. The first deliverable is a code review report identifying unsafe storage practices.","instructions":"---\nname: web-storage\ndescription: \"Use when reviewing scripts, client components, bundles, or runtime behavior related to Use Web Storage API safely. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.\"\nmetadata:\n  category: javascript\n  priority: medium\n  difficulty: beginner\n  estimatedTime: \"15\"\n  source: frontendchecklist.io\n  url: https:\/\/frontendchecklist.io\/rules\/javascript\/web-storage\n---\n\n# Use Web Storage API safely\n\nlocalStorage and sessionStorage have a 5\u201310 MB quota per origin, and any write can throw a QuotaExceededError. Private browsing modes in some browsers disable storage entirely and throw on all writes. Applications that don't handle these errors crash silently, leaving users unable to use the app.\n\n## Quick Reference\n\n- Always wrap localStorage access in try\/catch \u2014 storage can be full or disabled\n- Serialize objects with JSON.stringify and validate on read with JSON.parse\n- Never store sensitive data (tokens, passwords) in localStorage \u2014 use httpOnly cookies\n- Use sessionStorage for tab-scoped data that shouldn't persist\n\n## Check\n\nFind all localStorage and sessionStorage accesses in this file. Check for missing try\/catch, unhandled JSON parsing, and any storage of sensitive data.\n\n## Fix\n\nAdd try\/catch error handling to all Web Storage operations and ensure all object values are properly serialized and deserialized.\n\n## Explain\n\nExplain the Web Storage API, its limitations, when to use localStorage vs sessionStorage, and what data should never be stored there.\n\n## Code Review\n\nReview scripts, client components, and browser execution paths related to Use Web Storage API safely. Flag exact imports, event handlers, runtime side effects, or blocking operations that violate the rule, and state how the change should be verified in the browser.\n\n---\n\nFor full implementation details, code examples, and framework-specific guidance,\nsee `references\/rule.md`.\n\nRule page: https:\/\/frontendchecklist.io\/rules\/javascript\/web-storage\n","use_cases":["Reviewing scripts that use localStorage or sessionStorage","Debugging QuotaExceededError in browser storage","Ensuring secure handling of non-sensitive data in client applications"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/thedaviddias\/Front-End-Checklist\/blob\/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e\/skills\/web-storage\/SKILL.md","source_commit":"e8d14d049010e2ce25afcd5e8609dfcbbe63e47e","license":null,"version":null,"listing_approved_at":"2026-11-24","created_at":"2026-11-23T06:13:19.000000Z","updated_at":"2026-11-24T07:12:47.000000Z","seo_title":"Use Web Storage API safely for client-side data handling","seo_description":"Prevent crashes and data loss by safely using Web Storage API with error handling and proper serialization.","seo_keywords":["web storage api error handling","localStorage serialization","sessionStorage best practices"]}}