> I'd like to use onbeforeunload to submit a form before leaving a page.
This works in Firefox and IE. Safari, however, blithely ignores this.
Does anyone know of a workaround for Safari? Or another way to do the
same thing in Safari? (that is, intercept a request to leave the page).
I tried Safari 2.02 on Tiger.
<onbeforeunload> event handler is implemented only by browsers which
have "current page's state snapshot" mechanics.
What <onbeforeunload> is for:
1) to take the current page's state snapshot including each form
elements state/value and save in the data store on the client side: so
next time user comes on this page she will get it in the exactly same
state as she left it.
2) That's it!
What <onbeforeunload> is *NOT" for:
1) to nag users with idiotic questions:
- Are you sure you want to quit?
- Are you really really sure you want to leave now?
- Maybe you will stay here a bit more?
etc.
2) to sent/receive last minute data from server. Like:
- Sure I'll let you to leave... Just hold on for a couple of minutes
(hours) before I finish data exchange...
:-)
Safari and Konqueror are not such browsers, so they don't have
<onbeforeunload>. They are (as a greate amount of other wannabes)
rather featureless HTML/XML renderers. The only reason they are *so
far* taken into any account is that they are coming pre-installed with
Mac OS X and KDE for Linux respectively. So they are parasiting on some
users' mental inertion: it was here from the beginning, so I'll keep
using it. This tactic helped a lot to Internet Explorer to win the war,
but besides that it was at least a really powerful browser. I'm not
sure what their hope is on the long run.