Is there a 'Restore session' command-line argument for Firefox?
Solution 1
Your question is oddly framed. Why do you specifically want to be able to do this from a script? Do you just want to be able to start Firefox and restore your previous session, or do you specifically want to do this only part of the time?
Firefox has an option to restore the previous session all the time. In “Options” / “General”, set “When Firefox starts” to “Show your windows and tabs from last time”:
Then just start Firefox normally, and it will restore your previous session.
Solution 2
I think the UI setting to just load your last session on start up as shown in the other answer is the best. But just in case someone absolutely needs to know how to do this with command line you can try
firefox.exe -new-tab about:sessionrestore
It's actually just a page so it can be used with the -new-tab
and -new-window
parameters.
Related videos on Youtube
Mr. Mendelli
Updated on September 18, 2022Comments
-
Mr. Mendelli over 1 year
I would like to make a batch script for Firefox that restores my last session upon launching the script. I found that I could do this rather easily in Chrome with the
--restore-last-session
argument. I made this script and placed it along-sidechrome.exe
:chrome.exe --restore-last-session
Can the same be done with Firefox?
I am aware of the built-in options within the Firefox menu, butI would like to make this script so that Firefox restores instantly when I open it. -
Mr. Mendelli over 6 yearsYes, I wanted Firefox to restore my session every time I run it. I skimmed past the option in my haste to figure this out. Thank you for your answer.
-
Khalid Hussain over 6 years@Mr.Mendelli, this option is also available for Chrome.
-
Mr. Mendelli over 6 yearsYour script brings up the restore window as if Firefox unexpectedly stopped as you said, but shows no history options. I believe a
session.js
script needs to be defined (if possible) for the script to add the defined session as a valid option upon execution. Your script and parameters are good to know, I think I'll experiment with them and my theory just to see if this is possible with a batch script.