Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

En savoir plus

Can I have Firefox ask before closing the window if I hit Ctrl-W by accident.

  • 6 réponses
  • 2 ont ce problème
  • 15 vues
  • Dernière réponse par jferretti

more options

When filling out forms in the browser I sometime accidentally hit Ctrl-w from muscle memory. The ctrl-w is a write function in another program I use. When I hit Ctrl-w the window close with no warning and I can potentially use an hour of work.

Is there any way to configure firefox so it will pop up a confirm box when I click on the Ctrl-w warning me the browser window will close.

It is a very nice safety feature for touch typist that sometime moves too fast.

Thanks.

When filling out forms in the browser I sometime accidentally hit Ctrl-w from muscle memory. The ctrl-w is a write function in another program I use. When I hit Ctrl-w the window close with no warning and I can potentially use an hour of work. Is there any way to configure firefox so it will pop up a confirm box when I click on the Ctrl-w warning me the browser window will close. It is a very nice safety feature for touch typist that sometime moves too fast. Thanks.

Solution choisie

I thing the warning is displayed only when you have 2 or more tabs open in the same window if the corresponding box is checked in Options (Warn me when closing multiple tabs).

With only one tab, I'm afraid that it is not possible to be warned: in Firefox, CTRL + W closes the current tab, different from CTRL + Shift + W (or ALT + F4) to close the current window.

If this shortcut is really a problem for you, maybe you could change it with an add-on like Customizable Shortcuts.

Lire cette réponse dans son contexte 👍 1

Toutes les réponses (6)

more options

Solution choisie

I thing the warning is displayed only when you have 2 or more tabs open in the same window if the corresponding box is checked in Options (Warn me when closing multiple tabs).

With only one tab, I'm afraid that it is not possible to be warned: in Firefox, CTRL + W closes the current tab, different from CTRL + Shift + W (or ALT + F4) to close the current window.

If this shortcut is really a problem for you, maybe you could change it with an add-on like Customizable Shortcuts.

Modifié le par Banban

more options

My shop won't allow me to add the plugins, but maybe I should just get into the habit of having multiple tabs open when editing the forms.

Thanks for your input.

more options

Yes, this is indeed a "solution", but only when you use CTRL + W in a tab different from the one where you are editing a form.

You could also start Firefox with 2 home pages automatically. To set it, open the Options tab and paste about:home|about:home or about:home|about:blank in the Home Page field.

Modifié le par Banban

more options

Set the browser.tabs.closeWindowWithLastTab pref to false on the about:config page to prevent closing the last tab from closing that window and make a close button appear if only one tab is open.

You can open the about:config page via the location/address bar. You can accept the warning and click "I'll be careful" to continue.

more options

Hi jferretti, I just wanted to add a note about cor-el's suggestion.

If you switch the browser.tabs.closeWindowWithLastTab preference from true to false, when you Ctrl+w the last tab in a window, a new tab page will appear. Then you can undo the tab closure using either:

  • right-click the tab > Undo Close Tab
  • Ctrl+Shift+t

In most cases, Firefox should have preserved your place. However, you can improve your odds by using an extension like the following (IT department permitting):

https://addons.mozilla.org/firefox/addon/lazarus-form-recovery/


Another approach would be to inject a script into the page that displays a warning about leaving the page (it is caused by adding a handler for the window.onbeforeunload event). You may have seen that occasionally on annoying sites that don't want you to leave, or when closing an unfinished post on Google Groups or other sites.

Adding such a feature into a page would require either a manual action on your part, for example, if you know you are going to spend a lot of time on the page click a button to inject the script into the page, or using an add-on to watch your interaction with pages and add the handler if you are filling in a form.

Finding or writing the code would have to be an "after hours" project for me, so let me know if you're interested.

more options

Setting the browser.tabs.closeWindowWithLastTab to false and using the Ctrl+Shift+t does the trick. I ran a test and the unsaved text in the form was restored.

Thank you.