[Greasemonkey] halting navigation via Javascript

chris feldmann cfeldmann at gmail.com
Wed Oct 5 12:49:47 EDT 2005


On 10/5/05, Anthony Lieuallen <arantius at gmail.com> wrote:
> On 10/5/05, Matthew Weymar <matthew.weymar at gmail.com> wrote:
> > I'm told, but just wanted to confirm that there's no way to use Javascript
> > to stop a browser from navigating away from a given page.
>
> Incorrect.
>
> > I know that it's possible to intervene between the request to navigate away
> > and the actual move to another page, but there's really no way to stop this
> > move in its tracks?...
>
> There is a way.  Try out:
>
> http://www.arantius.com/misc/greasemonkey/protect-textarea.user.js
>
> If you visit a page with a textarea in it, type something in, then
> attempt to navigate away, you will be given a confirmation dialog.
> You're looking for onbeforeunload .
> _____

Are you sure that's not an ie-only event? It's not in this list:

http://www.mozilla.org/docs/dom/domref/dom_event_ref33.html

I suppose I could just go check myself......
__________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list