Software⏱️ 2 min read📅 2026-05-31

How to Fix: html5 localStorage error with Safari: "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota."

In Safari on iOS, the localStorage quota is limited to around 5MB. Try reducing the size of the data being stored or using a different storage solution like IndexedDB.

Quick Answer: Reduce the data size or use IndexedDB to avoid QUOTA_EXCEEDED_ERR in Safari's private browsing mode.

The QUOTA_EXCEEDED_ERR error in Safari's private browsing mode is caused by trying to store data that exceeds the browser's storage quota. This can happen when using localStorage without properly checking its available space.

🛑 Root Causes of the Error

  • Insufficient storage quota in Safari's private browsing mode.

✅ Best Solutions to Fix It

Method 1: Check Storage Quota Before Storing Data

  1. Step 1: Use the localStorage.length property to check if there is enough available storage space before attempting to store data.

Method 2: Reduce Data Size or Use a Different Storage Mechanism

  1. Step 1: Minimize the size of data being stored in localStorage to stay within the quota limits.

🎯 Final Words

To avoid the QUOTA_EXCEEDED_ERR error in Safari's private browsing mode, always check storage quota before storing data and consider reducing data size or using alternative storage mechanisms.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions