Countdown.js — super simple countdowns.
This would be perfect in conjunction with an "unload" event that triggers the countdown if the user decides to go to a different page on your web site. This way, the user doesn't have to stay on the page to make sure their actions are completed.
Instead of forcing the user to wait for the end of the countdown, you can use an "undo" button. Instead of actually undoing the operation, they would just be preventing it from happening in the first place.
undefined
This UI would leave me wondering if the deletion is going to go through if I close the page to do something else prior to the countdown completion.
It's interesting but how does it handle the case where the user navigates away before the counter hits 0?
This can be useful for more trivial actions, the consequences of which would be pretty minor for the user.
On the other hand for irreversible actions, as the authors put it (and ones more drastic than those mentioned here), a dialog, modal or otherwise, is perfectly warranted.
One more click hardly makes any difference in time, and it brings up a brief little moment for reconsideration in case the user doesn't immediately realize they're doing something potentially unwanted.