Firefox restores tabs each time I restore the browser, setting is not turned on
When I open Firefox after starting my computer, all of my tabs from the previous session are automatically restored, and they take several minutes to load. I don't have the "Open previous windows and tabs" setting enabled. Is there a way to stop Firefox from loading these tabs each time I open the browser?
I'm using Firefox 103 on KDE neon 5.25.
被選擇的解決方法
Do you Quit Firefox (using the menu) at least 30 seconds before you shut down the computer? Firefox needs time for its file maintenance and recording that your session terminated normally. If Firefox doesn't find the entry indicating that it shut down normally, it will attempt an automatic crash recovery at the next startup.
The Linux version of Firefox also has an integration with the OS so if you shut down the OS without first quitting Firefox, when Firefox is instructed by the OS that it needs to close for a system shutdown, it sets a flag to restore your session at the next startup.
從原來的回覆中察看解決方案 👍 1所有回覆 (2)
選擇的解決方法
Do you Quit Firefox (using the menu) at least 30 seconds before you shut down the computer? Firefox needs time for its file maintenance and recording that your session terminated normally. If Firefox doesn't find the entry indicating that it shut down normally, it will attempt an automatic crash recovery at the next startup.
The Linux version of Firefox also has an integration with the OS so if you shut down the OS without first quitting Firefox, when Firefox is instructed by the OS that it needs to close for a system shutdown, it sets a flag to restore your session at the next startup.
See also these prefs on about:config that Firefox automatically sets.
- browser.sessionstore.resume_session_once
- browser.sessionstore.resuming_after_os_restart
To make this work properly you would have to use an autoconfig.cfg file to test whether we have a restart due to OS restart and if true, set both resuming_after_os_restart and resume_session_once prefs to false. That way you can still have a valid restart to apply an update that keeps your session.
onQuitApplication:
You can use the autoconfig.cfg file in the Firefox installation folder to initialize (set/lock) preferences and run privileged JavaScript code.
To use Autoconfig, place two files into the Firefox installation directory.
- on Windows and Linux, they go into the same directory where Firefox is installed
- on macOS, they go into the Contents/Resources directory of the Firefox.app
The autoconfig.js file that specifies to use autoconfig.cfg is placed into the "defaults/pref" directory where the channel-prefs.js file is located. The autoconfig.cfg file is placed at the top level of the Firefox directory.
- autoconfig.cfg and autoconfig.js need to start with a comment line (//)
- autoconfig.js needs to use Unix line endings (LF instead of CR/LF)
See also:
The content of autoconfig.js:
// pref("general.config.filename", "autoconfig.cfg"); pref("general.config.obscure_value", 0); pref("general.config.sandbox_enabled", false);
The content of autoconfig.cfg:
// autoconfig.cfg need to start with a comment line // autoconfig.js => pref("general.config.sandbox_enabled", false); var Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services; if (Services.appinfo.restartedByOS) { Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", false); Services.prefs.setBoolPref("browser.sessionstore.resuming_after_os_restart", false); }
由 cor-el 於