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):
cmd-R
. You will be asked another time if you really want to leave the pageIs this a bug from Safari ? Is there a way to circumvent this problem ?
I was able to reproduce this issue even while skipping OP's steps 2 and 3. Any form of reload exhibits this issue. Minimalistic steps to reproduce:
The loading progress is visually pre-engaged right after the reload hit and stays so for the entire life of the confirm dialog (apparently in an effort to communicate the "hanging over cliff edge"-type mature of the situation ;) However:
X
symbol on and the loading progress still engaged and frozen somewhere around 10% mark.This really looks like a Webkit/Safari UI bug - it looks to fail to disengage the progress bar in stay-on-page conditions. Best would be to report it to the Webkit team or, since you experience this in Safari, maybe the Safari team would be better.