Pet Firefox peeve
June 14, 2006 1:32 pm GeneralHave you ever been working on a blog entry in firefox, and hit Ctrl-W instead of Ctrl-X by accident (or by habit)?
I don’t know how many times it’s happened to me, but it’s often. And always annoying.
Recently, I noticed a dialog when I tried to close on some website I can’t recall – “you have unsaved work, are you sure you want to close the window?” – I don’t know whether it was some Javascript in the page, or whether it was Firefox patched by Ubuntu, but I was very grateful.
Is this possible? Can I please stop losing unsaved work when there’s a form with text inputs on the page I’m closing by accident?
June 14th, 2006 at 11:04 pm
Well… A dialog that asks me if I want to exit always shows up when I have more than one tab open. It is a default setting. Check your preferences if you have turned it off…
June 14th, 2006 at 11:04 pm
Galeon (and as far as I know epiphany) do this, sometimes annoying when some javascript fills in a form for you, but it does seem to work.
June 14th, 2006 at 11:06 pm
Yes Epiphany does this if you leave unsubmitted text in a textbox form field.
June 14th, 2006 at 11:07 pm
Epiphany does this out of the box for all websites.
Blogger has some JavaScript that does it too, maybe that was what you saw?
June 14th, 2006 at 11:07 pm
Try (if I am not mistaken):
var Navigate = false;
var NavigateMessage = “You have unsaved work”;
June 14th, 2006 at 11:10 pm
meastp: I’m not closing the entire window, just closing a tab with Ctrl-W – which typically doesn’t give any warning at all.
Thanks all for the Galeon tip – I will also need something that works on Windows, though…
Jeroen: Try it where?
June 14th, 2006 at 11:20 pm
It’s javascript, catch the onbeforeunload event.
June 14th, 2006 at 11:24 pm
Sorry, that was a bit to sparse
var confirmClose = true;
function confirmNavigate()
{
if (confirmClose)
return “Do you want to save your work?”;
}
June 14th, 2006 at 11:48 pm
Hmm, wasn’t aware that any html stuff would be removed.
In your body element do a:
onbeforeunload=”return confirmNavigate();”
June 15th, 2006 at 12:23 am
You might find http://www.arantius.com/article/protect+textarea useful, which is a GreaseMonkey script to do just what you’re looking for. (It only applies to textareas, not one-line input boxes, but it’s trivial to hack one-line text support in for a JavaScript person.)
June 15th, 2006 at 1:57 am
You know, ctrl-w is supposed to do exactly that. On all the modern sane applications, without ANY whining. Ever. You’re just a skilless noob.
June 15th, 2006 at 1:59 am
Yeah I always do this, esp after using nano (where ctrl-w is find)… What might be nicer with the prevelance of gui editors with similar shortcuts would be for nano to adopt key shortcuts that will be familiar to users of gui apps
June 15th, 2006 at 3:08 am
that would be so evil if kids got hands on
it’s simple javascript callback “onunload” event, write function that checks forms for unsaved data and/or cancel/continues navigation
kids can use this to make you never ever leave the site
June 15th, 2006 at 4:10 am
This used to happen to me all the time as well. It’s very, very frustrating. I finally ended up enabling emacs shortcuts in Firefox. Now, when I hit ctrl+w while typing in a text box, it erases a word rather than closing the window. To find out how to do that, go here:
http://kb.mozillazine.org/Emacs_Keybindings_(Firefox)
June 15th, 2006 at 5:17 am
try undoclosetab extention
http://mozilla.dorando.at/readme.html
using this you can undo any ctrl-w
June 15th, 2006 at 7:57 am
Guh… just compile Epiphany for Windows and be done with it. 😛
June 15th, 2006 at 11:14 am
blogger does this when you are writing a comment iirc
June 15th, 2006 at 2:54 pm
you just gave me an idea for a new firefox extension, tnx!
and btw, is the onbeforeunload event.
June 17th, 2006 at 5:47 am
I saw this for the first time on a comment on blogger.
To try it : go to a blogger blog, go to the comment writing page, start to write and then try to go to another page.