So I'm making a web-based image editor, and I'm facing a problem. The user is editing one or more images, and has the option to save it. So, when the user clicks "save", a dialog box pops up where the user saves the image (I don't have control over this dialog box). Here's where the problem lies; I cannot detect (impossible, to keep websites secure) when the user clicks "cancel" in that dialog box. When a user closes an image, I need to ask the user if he/she wishes to save the image, but not if the user already did. Should I

  • Assume the user didn't click "Cancel" in that dialog box, and not ask to save the image if the user clicked "save" before closing the image (even if the user didn't actually save by clicking "Cancel")
  • Always ask for confirmation when closing an image, even if the user's clicked "save" right before closing the image

Or perhaps there's a better solution to this? I should add: the image is lost after the user closed it, so an "undo" button is off the table.

2 Answers 2


the image is lost after the user closed it, so an "undo" button is off the table.

In this scenario you should try to prevent the worst case, which is that the user didn't click "Save". Therefore never presume he clicked "Save" and ask him again.

Another suggestion is to show the Save dialog only when the user closes. So instead of showing: Save | Close, you present both actions together: Save & Close | Close without saving. In this scenario the user can only save once (does this make sense in your case?), but you won't be asking him twice.


Assuming by saving you mean letting the browser do something like Save to file on the device, have you considered saving the image in your system?

In your conundrum the principle of User input is Holy seems to battle the principle of Thou shall not annoy the User with unnecessary popups. (Better name for this principle wanted)

If you make your system so that images are never lost unless explicitly deleted, then not asking to Save to File will not be fatal. Returning to the site will load the last image worked on, or a catalog of all the user's images. I fully respect that this would be a challenging task, and by using techniques like sessions, cookies, browser db or user catalog on your service, there may still occur unwanted lost input, but in 99% of the times, you would be good.

  • You're completely right, this is better; however, I do not have access to a large enough database and as such I'm making it a client-side application that doesn't use the internet once fully loaded. I shouldn't save images that the user's closed because of the space it takes, I should really use that space for an "undo" button
    – user98460
    Commented Mar 15, 2017 at 9:45
  • Yes, I would consider running out of server space being a pleasant problem though, and could it not be stored on the client side? Any how down the product development path, I understand the challenge and happy you found a solution for this stage.
    – JOG
    Commented Mar 15, 2017 at 10:46

Your Answer

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