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.