whenever you try and leave, even if changes are saved, just check if any changes have been made since the last saving, and only if so, popup that alert.
I don't think you understood the request. The OP is saying that it shouldn't popup the dialog if you already saved. Presently, it already pops up the dialogue no matter what when you go to close it.
I asked for this a long time ago and Jens told me that it's not possible to make that message conditional on having unsaved edits because it comes from the browser, not from Snap! itself, and you tell the browser to do it when you load a URL (in our case, the Snap! URL).
It can be better to use it or not use it depending on the circumstances in my opinion. For example, you probably wouldn't type window.world, just world.