You have the browser "On suspended"/"On resumed" conditions that could do the trick.
As far as I'm aware, alert dialog are not suspending the application, as they are actually part of the OS/browser (Browser alert), so using the before mentioned conditions should only apply when you are actually "suspending" the execution of the application, going to do something else (checking another application, receiving a phone call, etc...) and so should be the best way to go about things.
Otherwise, I don't believe there are internal flags or messages that allows you to check "where you are resuming from".