There is not much you can do to prevent that. If the user refreshes the page, then they'll get exactly what they got last time, including the alert. You could use AJAX on the page in question and fire the client side code after callbacks. When the user refreshes the page they'll be refreshing the page in the original state which didn't have the alerts or other dynamic events triggered by AJAX activities.
-
Peter