On this page
What this issue is
localStorage is a small store in the browser that your scripts use to remember things: a cart ID, a half-filled form, a step number, a consent choice. It normally works fine. But in some cases it is unavailable: private or incognito windows in some browsers, browsers set to block all site data, or a full storage quota.
Why it costs you leads or sales
A script that crashes on a storage call can leave a multi-step form stuck on step one, a cart that never saves, or a popup that will not close. The visitor sees a button that does nothing. They rarely report it. They leave.
The share of visitors affected is usually small, which is why the impact is low. But privacy-minded visitors are often the same people who compare options carefully, and the failure is silent in your reports because no error is shown on the page.
- Visitor opens pagePrivate window, storage blocked
- Script saves steplocalStorage.setItem throws an error
- Form moves onCode after the error never runs
- Lead submittedNever reached
A thrown error on the storage call stops the script, so later steps never run.
The script throws on the storage call and the button stops responding.
How to check if your site has it
Open a private window
Use Safari Private, Chrome Incognito and Firefox Private Window. Walk through your main form or checkout.
Block site data on purpose
In Chrome, open Settings > Privacy and security > Third-party cookies, or use Site settings to block cookies and site data for your domain. In Firefox, use Settings > Privacy & Security > Custom and block cookies. Reload and retry.
Open the console
Press F12 and open the Console tab. Look for errors mentioning localStorage, SecurityError, QuotaExceededError or 'Access is denied'.
Search your code
Search your theme, plugins and tag manager scripts for
localStorageandsessionStorage. Check each call is inside try/catch.Test in-app browsers
Open your page from a link inside social apps and email apps. These browsers can have stricter storage rules.
How to fix it
The fix is the same everywhere: never call storage directly. Use a small helper that tests storage once, catches errors and falls back to memory.
const safeStorage = (function () {
const memory = {};
let ok = false;
try {
const k = '__test__';
window.localStorage.setItem(k, '1');
window.localStorage.removeItem(k);
ok = true;
} catch (e) {
ok = false;
}
return {
get: function (key) {
try { return ok ? window.localStorage.getItem(key) : (memory[key] || null); }
catch (e) { return memory[key] || null; }
},
set: function (key, value) {
try { if (ok) { window.localStorage.setItem(key, value); return; } }
catch (e) {}
memory[key] = String(value);
},
remove: function (key) {
try { if (ok) window.localStorage.removeItem(key); }
catch (e) {}
delete memory[key];
}
};
})();Replace direct calls
Swap every
localStorage.getItem/setItemfor the helper above. Keep important data, like a cart ID, on the server so a lost browser store does not lose it.
Find the source
Search your theme and plugin files for localStorage. If a plugin causes the error, update it or contact its developer. Put your own fixes in a child theme or a code snippet plugin, not in plugin files.
Check theme and app scripts
In Online Store > Themes > Edit code, search for localStorage in your theme JavaScript and wrap calls in try/catch. For app scripts, report the issue to the app developer.
Fix custom HTML tags
Open Tags and review Custom HTML tags and Custom JavaScript variables that use localStorage. Wrap them in try/catch and use Preview mode to test in a private window.
Check custom code
Review Project settings > Custom code and any Embed elements. Wrap storage calls in try/catch or use the helper.
How to confirm it's fixed
- The form submits in a private window in Safari, Chrome and Firefox.
- The checkout or cart works with site data blocked.
- The console shows no localStorage errors.
- Tracking and consent scripts still run after the storage call.
- A test lead reaches your inbox or CRM.
Before
- Script calls localStorage directly
- Error stops all code after it
- Form or button does nothing in private mode
After
- Calls go through a try/catch helper
- Falls back to memory when storage is blocked
- Form submits even without saved progress
How to prevent it happening again
- Ask developers and agencies to use a storage helper, never raw calls.
- Include a private-window test in your release checklist for every form and checkout change.
- Keep key state, like carts and lead IDs, on the server or in a cookie as a backup.
- Retest after installing or updating plugins, apps and tag manager scripts.
- Watch your browser console for errors after each launch.
How FunnelGuard handles this
FunnelGuard does not check this yet. It has no private-mode or blocked-storage variant of its robot visitor, so it will not tell you that a script fails when localStorage is unavailable. It is a possible future check.
What FunnelGuard does do nearby: it runs your real journeys on a schedule, checks each step, and checks tracking hits and test leads. If a script error stops a form for all visitors, a failed step is re-checked from a second region and then you get one alert with a screenshot and a likely cause. That only covers the standard browser setup, not private mode.
To watch for this issue today, add a private-window test to your launch checklist, and use your browser's developer tools or a JavaScript error tracker to see storage errors. The free plan (1 site, 2 journeys, daily checks) helps cover the main journeys while you test the private-mode cases by hand.
Questions people ask
Why is localStorage not working in private mode?
Some browsers and settings block or limit site storage in private windows or when site data is blocked. The call can throw an error such as SecurityError or QuotaExceededError. Wrap storage calls in try/catch to handle it.
How do I check if localStorage is available in JavaScript?
Try writing and removing a test key inside a try/catch block. If it throws, storage is unavailable. Do not rely only on checking whether window.localStorage exists.
Why does my form work normally but not in incognito mode?
Your form script may use localStorage or sessionStorage and crash when it is blocked. The error stops later code, such as the step change or submit handler. Check the console in a private window.
What is a good fallback when localStorage is blocked?
Use an in-memory variable for the current page, or a cookie for small values. For important data such as a cart or lead ID, store it on the server. Visitors should still complete the form without saved progress.
Is localStorage safe to use for carts and forms?
It is fine as a convenience, but not as the only place a cart or form state lives. Browsers can clear, block or limit it. Keep key data server-side and treat storage as optional.
Does FunnelGuard test my site in private mode?
No. FunnelGuard does not have a private-mode or blocked-storage check yet. It does run your real journeys on a schedule and check steps, tracking and test leads in its standard browser setup.
How do I test my website in private browsing?
Open a private window in Safari, Chrome and Firefox and complete your main form or checkout. Keep the console open to see errors. Also try blocking site data for your domain in browser settings.
Related issues
- CNV-376Session cookie lost between stepsFix guide
- CNV-378SameSite settings break iframe login/checkoutFix guide
- CNV-380CSRF token expired, form rejects submitFix guide
- CNV-383Cookie consent state not respected after choiceFix guide
- CNV-377Cookie too large, server 400 errorFix guide
- CNV-381Cached page serves stale CSRF/nonce (WordPress cache)Fix guide