Cerca nel supporto

Attenzione alle mail truffa. Mozilla non chiederà mai di chiamare o mandare messaggi a un numero di telefono o di inviare dati personali. Segnalare qualsiasi attività sospetta utilizzando l'opzione “Segnala abuso”.

Learn More

Questa discussione è archiviata. Inserire una nuova richiesta se occorre aiuto.

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

  • 6 risposte
  • 2 hanno questo problema
  • 3449 visualizzazioni
  • Ultima risposta di 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.

Soluzione scelta

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.

Leggere questa risposta nel contesto 👍 1

Tutte le risposte (6)

more options

Soluzione scelta

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.

Modificato da Banban il

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.

Modificato da Banban il

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.