搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

Learn More

Firefox restores tabs each time I restore the browser, setting is not turned on

  • 2 个回答
  • 0 人有此问题
  • 144 次查看
  • 最后回复者为 cor-el

more options

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.

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)

more options

选择的解决方案

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.

more options

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于修改