i'm designing a mobile web based e-commerce solution. If the user closes the browser window, items in their cart will be lost (assuming they rejected the initial cookie request) when they return. To prevent this i'm considering prompting the user if they are sure they want to close the browser and would like to create an account . Is this a good way to overcome this issue or is there another way?

  • 2
    Assuming that this case is mostly for non-logged in users. By rejecting cookies, users accept these kind of unwanted outcomes. Well ofc, it's a bad UX to lose everything in your cart but also coming up with an action intrusive pop-up blocking users action is same as bad. Tbf, it's a hard decision but seems like both ways would have it's consequences. I'm going to look from another way and say that maybe you can promote users to sign up to your system. So they won't lose their stuff when they close the window.
    – Korhan
    Commented May 30, 2020 at 10:50

2 Answers 2


Presenting a warning about data loss is always a good idea.

Ameen, one of the most important fundamental rules of good UX design, IMHO, is to make sure that users never unintentionally lose data.

With that in mind, your users will typically navigate away from your site for two reasons:

  1. They decide not to make the purchase, after all.

    Presenting the warning might bother the user, but since they already decided to leave your store, that's a potential issue I wouldn't be too concerned about.

  2. They navigate away by mistake (incl. that they incorrectly expect the cart contents to be saved)

    If the user does lose their cart contents, you risk to annoy them so much that they are not willing to start over from scratch. Even if they do start over, they will remember what an awful experience that was. As a result, your site will lose reputation and business!

    Presenting the alert will prevent that from happening. And it's a small price to pay for the user to have a safe, efficient shopping experience.

Ideally, the system safeguards users' data automatically.

A better solution is, of course, to synchronize any changes to the cart with the server as soon as possible. That way, you don't need to display with a warning at all.

This also addresses the technical issue that it is not always possible to intercept the user navigating away from a page. Just think of someone force-quitting the app if it's frozen…

Never require creating an account during check-out.

One more thing: do not require your site's visitors to create an account in order to complete the purchase. Always — always — allow users to check-out without having to create an account!

Jared Spool's story about the $300 Million Button explains why.

To really "delight" your first-time users, offer to create an account for them after they have entered their address, payment info, etc.

At that point in the user journey, your site has already captured all that data anyway — except for username and password. Choosing just those two data items will feel much less like a burden to your users, than having to enter all that other stuff "just to create an account."


I think a lot of web applications do this. Sites will trigger the browser to say for example 'you have unsaved work/ data'. Quite fine from a user point view I think.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.