Gossamer Forum
Quote Reply
Navigate away block?
Anyone have code that can be used on the edit screen to prevent navigation away from the page?

The way the advanced editor works, is if you accidentally leave the page, all work is trashed, without any sort of "arey you sure you don't want to send this message" prompt.

Just something simple like a "Do you really want to leave this page Yes/No", but that will catch and prevent any sort of navigation away, no matter what button was pressed. With different keyboards, and users going from computer to computer, the chances of this happening increase all the time -- and it creates a _massive_ amount of frustration.

I can't count how many times I've lost a long post because I hit the backspace key, or some other funky key on the keyboard, and windows had shifted the focus.

How many people start to post, lose it, and then just go away? It's possibly the most unfriendly feature of GForum, since it's so hidden, you don't realize it's insidiously doing this to your visitors.

Many other programs are using them, and Google's GMail has it also. It's saved me many times.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Navigate away block? In reply to
Just add this body line:

Code:
<body onbeforeunload="return 'WARNING: Your post/message will be lost if it is not being submitted!'">

Sean

Last edited by:

SeanP: Sep 30, 2005, 7:11 AM
Quote Reply
Re: [pugdog] Navigate away block? In reply to
Actually, that will prompt you even if you submit the form successfully. This might be more of what you are looking for:

http://javascript.about.com/library/blvalsub1.htm

If the form is not submitted, you can have it pop the unload message.

Sean

Last edited by:

SeanP: Sep 30, 2005, 7:25 AM