The following gist: https://gist.github.com/1876791 (borrowed from the demo in this question)
is a dead simple example of usage of window.onbeforeunload
in js.
The problem we have is the following (Happens with Safari 5.1.3 and not Latest Chrome version):
- Visit this page: https://web.archive.org/web/20211028110528/http://www.4guysfromrolla.com/demos/OnBeforeUnloadDemo1.htm
- Click on one of the links, you will get an alert asking you if you really want to leave this page
- Click "Stay On Page"
- Reload the page using
cmd-R
. You will be asked another time if you really want to leave the page - Click "Stay On Page".
- Safari stays in a "loading" status, with the progress bar showing as if it were to load the next page.
Is this a bug from Safari ? Is there a way to circumvent this problem ?