Is there a 'Restore session' command-line argument for Firefox?

5,727

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”:

Firefox “Options” / “General” page

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.

Share:
5,727

Related videos on Youtube

Mr. Mendelli
Author by

Mr. Mendelli

Updated on September 18, 2022

Comments

  • Mr. Mendelli
    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-side chrome.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, but I would like to make this script so that Firefox restores instantly when I open it.

  • Mr. Mendelli
    Mr. Mendelli over 6 years
    Yes, 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
    Khalid Hussain over 6 years
    @Mr.Mendelli, this option is also available for Chrome.
  • Mr. Mendelli
    Mr. Mendelli over 6 years
    Your 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.