On this page
What this issue is
A visitor fills in part of a form or adds items to a cart, clicks a link (a terms page, a shipping policy, a payment step), then presses the browser's Back button. They expect to land where they were, with everything still there. Instead the form is blank, a multi-step form restarts, or the cart shows zero items.
Why it costs you leads or sales
Re-typing is work. Many visitors will not do it twice. On mobile, where typing is slow, the loss is worse. A lost cart is worse still: the visitor has to find the products again, and some will buy elsewhere instead.
Example: illustrative numbers only. Of 100 visitors who press Back mid-form, fewer finish when their entries are gone.
- Fill in form / add to cartVisitor invests effort
- Open another pageTerms, shipping info, payment step
- Press BackFields empty, cart reset
- Re-enter detailsMany give up here
- Lead or orderNever completed
The break happens on return, so everything after it is lost.
How to check if your site has it
This takes five minutes and needs no tools. Test on desktop and on a real phone, because mobile browsers handle the cache differently.
Fill in the form
Type into several fields, including a dropdown, a checkbox and a text area. Do not submit.
Leave the page
Click an internal link such as the privacy policy, then press Back.
Check the fields
Note which values survived. Repeat in Chrome, Safari and Firefox.
Test the cart
Add a product, open another page, press Back, then check the cart count and contents. Also try going back from the checkout step to the cart.
Test multi-step forms
Go to step 3, press Back once. You should land on step 2 with its answers, not on step 1 or a blank page.
Inspect headers
In Chrome DevTools, open Network, click the page request and read the Response Headers. Look for
Cache-Control: no-store.
How to fix it
Start with the cause the test pointed to. The usual ones are below.
| Cause | Symptom | Fix |
|---|---|---|
Cache-Control: no-store on the page | Page reloads fresh, fields empty | Use no-cache or private, max-age=0 on form pages where safe |
unload or beforeunload handler | Page not eligible for bfcache | Replace with pagehide or visibilitychange |
autocomplete="off" on fields | Browser will not restore typed values | Remove it, except on sensitive fields such as card numbers |
| Form built by JavaScript after load | Fields render blank on return | Save values to sessionStorage and refill them |
Script calls form.reset() on load | Values wiped | Only reset after a successful submit |
| Cart stored only in page memory | Cart empty after Back | Store the cart in a cookie, server session or localStorage |
Check caching and security plugins
Some plugins send no-store headers on pages with forms. Look in your cache, security and membership plugin settings for options about sending no-cache headers, and exclude form pages from them where possible.
Review your form plugin
Look in the form plugin's settings for options about saving partial entries or progress on multi-step forms. Availability depends on the plugin and version.
Test with plugins off
On a staging copy, deactivate plugins one at a time and repeat the Back test to find the culprit.
Check the theme's cart drawer
If the cart only lives in a JavaScript drawer, make sure it reads from Shopify's cart (
/cart.js) on page load, not from page memory.Remove blocking scripts
In Online Store, Themes, edit code, search for
unloadandform.resetin theme and app scripts. Replaceunloadwithpagehide.Test apps
Disable recently added apps one by one on a duplicate theme and retest.
Find tags that add unload handlers
Check Custom HTML tags for
unloadorbeforeunloadlisteners and change them topagehide.Use Preview mode
Run Preview, repeat the Back test and see which tags fire again on return.
Check custom code
In Project Settings, Custom Code, and in page-level custom code, look for scripts that reset forms or use
unload.Keep forms in the HTML
Native Webflow forms are in the page HTML, so browsers can usually restore them. Avoid replacing them with forms injected by scripts.
Test funnel steps
Run the Back test between funnel steps and on embedded forms. Behaviour depends on how steps are loaded.
Check custom code
Look in the funnel's custom code and tracking code for
unloadhandlers or scripts that clear fields.
Review Velo code
If you use Velo, check page code for calls that clear inputs on load, such as setting
$w('#input').value = ''inonReady.Test the Wix cart
Add items, navigate away and go Back. If the cart is lost, check for third-party apps that change cart behaviour.
Check code injection
In Settings, Developer Tools, Code Injection, look for scripts using
unloador resetting forms.Test form blocks
Fill a form block, leave and return. If it clears, remove added scripts and retest.
Fix the headers
Remove
no-storefrom form pages unless the page shows private data. See the snippets below.Save progress
Write non-sensitive field values to
sessionStorageon input and refill them on load and onpageshow.Keep the cart on the server
Store the cart in a session or database tied to a cookie, not only in JavaScript variables.
const form = document.querySelector('#lead-form');
const KEY = 'lead-form-draft';
function save() {
const data = {};
new FormData(form).forEach((v, k) => {
if (k !== 'card_number' && k !== 'password') data[k] = v;
});
sessionStorage.setItem(KEY, JSON.stringify(data));
}
function restore() {
const saved = JSON.parse(sessionStorage.getItem(KEY) || '{}');
Object.entries(saved).forEach(([name, value]) => {
const el = form.elements[name];
if (el && !el.value) el.value = value;
});
}
form.addEventListener('input', save);
window.addEventListener('pageshow', restore);
form.addEventListener('submit', () => sessionStorage.removeItem(KEY));// Before: blocks the back/forward cache
window.addEventListener('unload', sendData);
// After
window.addEventListener('pagehide', sendData);location /contact/ {
add_header Cache-Control "private, max-age=0, must-revalidate";
}Before
- Form fields are empty
- Multi-step form restarts at step 1
- Cart shows 0 items
After
- Typed values are still there
- Visitor returns to the step they left
- Cart keeps its items
How to confirm it's fixed
- Repeat the manual test in Chrome, Safari and Firefox on desktop
- Repeat it on a real iPhone and an Android phone
- Run Chrome's Back/forward cache test and confirm the page is restorable
- Check the cart count and contents after Back
- Check that a successful submit still clears the saved draft
- Submit a test lead to confirm the form still works and arrives
How to prevent it happening again
- Add the Back test to your release checklist for any form, cart or checkout change
- Review new plugins, apps and tags for
unloadhandlers and no-store headers - Avoid
autocomplete="off"except on sensitive fields - Keep carts server-side or in persistent storage
- Retest after theme updates and caching or CDN changes
How FunnelGuard handles this
FunnelGuard does not check for this yet. Testing Back-button behaviour is a possible future check, so for now you need to test it by hand or with browser tools as described above.
What FunnelGuard does cover nearby: a robot visitor runs your real journeys on a schedule, such as lead forms and checkouts, and checks each step, the tracking hits and whether test leads reach your inbox and CRM. If a change breaks the form or checkout itself, that is the kind of failure it re-checks from a second region before sending one alert with a screenshot and likely cause. That will not tell you whether Back restores entries.
Questions people ask
Why does my form clear when I press the back button?
Usually the browser cannot restore the page from cache. Typical causes are a Cache-Control: no-store header, an unload handler, autocomplete="off" on the fields, or a script that resets the form on load. Test in Chrome DevTools under Application, Back/forward cache to see the exact reason.
Why is my cart empty after I click back?
The cart may be held only in page memory or fetched in a way that is not repeated when the page is restored. Store the cart in a server session, cookie or persistent storage, and reload it from there on page load.
How do I stop the back button from losing form data?
Remove no-store headers and unload handlers from the form page, drop autocomplete="off" from non-sensitive fields, and save progress to sessionStorage so you can refill fields when the page is shown again. Clear the saved draft after a successful submit.
What is the back/forward cache (bfcache)?
It is a browser feature that keeps a snapshot of a page in memory when you leave it. Pressing Back then shows the page instantly, with form values and scroll position intact. Some code, such as unload handlers, stops a page being stored.
Is it safe to save form data in the browser?
It is fine for ordinary fields like name or message when you use sessionStorage, which clears when the tab closes. Never store card numbers, passwords or other sensitive data, and delete the draft after submission.
Does the back button problem affect multi-step forms?
Yes, and often more. If each step is loaded by JavaScript without updating history, Back can leave the form entirely or restart it. Give each step its own history entry and keep earlier answers stored so Back returns to the previous step with its answers.
Can FunnelGuard detect when the back button loses form state?
No, not yet. It is a possible future check. FunnelGuard does run your real journeys on a schedule and checks that steps, tracking and test leads work, but you need to test Back behaviour manually for now.
Related issues
- PRF-229Back button broken (history hijacked, redirect loop)Fix guide
- PRF-216Form loses entered data on validation errorFix guide
- PRF-215Errors only shown after submit, all fields clearedFix guide
- PRF-220No thank-you/confirmation after submitFix guide
- PRF-219Submit button disabled with no explanationFix guide
- PRF-212Required fields not markedFix guide