I Hate Web Browsers

I just wrote a long and brilliant post into a text box in a web browser. I hit Command-Left Arrow to go to the beginning of the line. (For those without MacBooks, Fn+Left Arrow is Home, which *should* take you to the beginning of the line, but for some reason text boxes in Firefox on OS X don’t actually respond to Home, so you have to use Command-Left Arrow.)

The problem is that not all javascript-y AJAX-y sexy WYSIWIG Web 2.0 text areas actually *implement* Command-Left Arrow. A basic Firefox text area *will* move to the start and end of line with Command-Left and Command-Right arrows. But for some reason, when a javascript-y AJAX-y WYSIWIG Web 2.0 editor wraps a text area, sometimes they don’t handle Command-Left, and instead pass that straight through to Firefox. What does Firefox do with Command-Left? Why, return you to the previous page, of course!

This is about the 3rd or 4th time this has happened to me. In fact, I have a habit now of doing “select all; copy” so I at least have the text stored in the system clipboard. I know I am not the only one. Why doesn’t Firefox just have an internal flag on text areas that triggers whenever the user actually enters more than, say, 10 words, and automatically prompt the user if they try to close or navigate away from a page with unsaved text in those text areas? Can someone more knowledgeable about web browsers and plugins and DOMs tell me if this is a difficult thing to implement as an add-on? I know there are some plugins that allow you to manually save the text in an edit window to disk, but that’s way too heavyweight and manual of a process. Does anyone have a suggestion for a plugin or add-on that actually solves this problem?

18 thoughts on “I Hate Web Browsers

  1. avatarHeikki Toivonen

    I know the feeling. There are also other “features” that will make you lose your edits when the textareas are dynamically created by Javascript.

    On one hand I believe Firefox itself could retain and refill the text even in some dynamic cases (if there is just one textarea, or if the textarea retains the id/name for example). I should go and file a bug.

    I believe there is an event (I can’t remember if it was ‘unload’ or something else) that will be fired just before you are about to leave a page. You could write an extension, or perhaps a Greasemonkey script, to do something special in that case on pages that have textareas with content.

  2. avatarJ

    Safari remembers what you typed in those text boxes if you accidentally go back a page and then forward again. It also prompts you if you’ve entered text on a page and then try to close the tab.

  3. avatarMarius Gedminas

    Usually (although not always) when you accidentally go back in history, you can go forward and Firefox will remember what you had entered into a text area.

    It worked for me just now on this blog.

  4. avatarDougal Matthews

    I believe its because those “javascript-y AJAX-y WYSIWIG Web 2.0 editor[s]” are behind the scenes doing crazy things with a text box. This then leaves the browser without the focus remaining on the text box, so it doesn’t know you are typing. A pain I know.

    I’m not sure how difficult it is to do but I imagine there are some issues. For example you can’t capture all key presses. This is for obvious reasons as you don’t want websites changing standard web browser functionality. Therefore I think the only way to do it might be to ‘fake’ the focus of the text area? I’m not really sure but you’ve made me curious. I might just have a look into it. Can you point me to a particular editor that you’ve found this with?

    I tend to do select all and copy too. In fact, I tend to do that on any type of text box if I write lots, just in case. I will with this one. I’m a windows (don’t hate me 🙂 ) and now Chrome user, maybe when it comes to the Mac your views of browsers will be improved (at least slightly).

  5. avatarRobin

    But you should be able to go forward again and the text should be there, because Firefox saves it. Well, at least that’s the way it works in Firefox 3 here on Linux. But maybe it doesn’t work because of these oh-so-fancy AJAX text areas.

  6. avatarNeil

    I sometimes use the “It’s All Text” addon; you can use it to edit the text field in a separate editor (whatever your favourite editor is), and has the side benefit of not losing the text if you navigate away. I don’t find it too heavywight – you just click a button (or use a keyboard shortcut) to open the editor, and the textbox is automatically updated whenever you save the file in the editor.

  7. avatarTom

    This often happens to me when editing WordPress posts. Thankfully, it has auto-save, but I’ve never noticed a time when going back/forward actually erases the text in the textarea; most browsers seem pretty good about it. I tested it in Safari just now and I didn’t have to rewrite this…

    I agree that it’s quite annoying when textareas or “Javascripty Textareas” behave this way. If I’m writing something really long I will just write it in an editor and paste it when I’m done.

  8. avatarChris

    One of the things I love about TextMate is the “Edit in TextMate…” feature that takes the contents of the current browser text box and opens it in the TextMate editor. Saving the file then throws the edited contents back in the text box. Its saved me numerous times when Safari has done something unexpected, and gives me all the advantages of editing in a proper app.

  9. avatarpwang

    Hey guys, sorry that your comments just showed up – they were waiting in the moderation queue.

    The editor that was giving me problems was TinyMCE, specifically, as hosted at this site: http://www.politicalmachine.com. (Click on any of the headings under “political debate” and at the bottom of the page, there will be an embedded TinyMCE editor.) (Disclaimer: this is a political site and regardless of your political views, your head will asplode if you read too many of the comments.)

    Neil, Bruno, and Derrick (who emailed me):
    Thanks for suggesting “It’s All Text”. I’ve installed it and will restart firefox after posting this.

    Robin and Marius:
    You are exactly right that FF3’s default behavior with “bare” text areas is great, and it saves your work. I’m only seeing this problem with the fancy javascripty ones.

    I just confirmed that Safari has this same problem with TinyMCE.

    General disclaimer: I know that technically calling them “AJAX-y” is incorrect, because these text boxes almost certainly *aren’t* asynchronously saving my text to the server.

  10. avatarDave Kirby

    +1 for the “Its All Text” plugin (https://addons.mozilla.org/en-US/firefox/addon/4125) – I can seamlessly switch between a firefox text box and my editor of choice (Vim).

    However it will only work with plain text, not with WYSIWYG Javascript edit boxes, so I disable WYSIWYG editing where possible. On the other hand doing that would mean that your Fn-left arrow combination would then work, so you would not have the problem in the first place.

    1. avatarGrok

      Oh I know this is an old post and old comment, but damn that is an awesome add on. I love vim and always miss it when I have to use some inferior system. Thanks! 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *

Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 101,567 bad guys.