Restore Safari workflow after a crash
After Safari is quit or crashes, you can relaunch all the previously opened windows to restore your workflow without having to open and position each one individually.
Depending on your Web uses, you may have multiple browser windows open, and if you make use of tabbed browsing you can easily find yourself having multiple tabs on multiple windows, resulting in a large number of pages being loaded at once. While this can potentially make your browser hog RAM and CPU cycles, overall having numerous pages loaded should not be a problem for the browser or system. It does, however, pose a problem if the browser is quit or unexpectedly crashes, since opening and organizing all the windows again can be an exercise in frustration.
To get around this, Safari has a feature to reopen all windows in from the last session, which will open every window and the tabs for that window. The next time you open Safari, go to the "History" menu and choose "Reopen all windows from last session" and the browser will load them up. The ones that will not fully load the way they were usually are those that require authentication, such as Webmail, online banking, and other Internet services.
Not only can this feature be used to restore a lost session after a crash, it also can be used to reduce Safari's RAM footprint after an extended browsing session. Over time, Safari tends to increase the amount of RAM it uses, and while closing windows should help clear this, doing so when you have many windows open can just be a burden. Provided you are not working extensively with sites that require authentication, you can easily quit Safari and then relaunch it and open all the windows again. Likely after doing this you will find Safari's RAM footprint has been reduced even though the same windows are open.
This feature in Safari is done by the use of a separate property list file called "LastSession.plist" that is located in the /username/Library/Safari/ folder. As you open new tabs or windows, or reposition those on screen, Safari will update the "LastSession" file with this information so it will be available the next time Safari is launched.
This feature can be useful even if you do not keep that many browser windows open.
Though convenient, sometimes people might make the mistake of quitting a Safari session and then launching and quitting the program again before restoring the last session. This will result in Safari clearing the "LastSession.plist" file, and causing you to lose that entire session. If this happens to you, if you have a regular backup like Time Machine you may be able to restore the lost session. Go to the /username/Library/Safari/ folder and invoke Time Machine. Then go back to the most recent backup instance, and restore the "LastSession.plist" file, replacing the current one. Then when you next launch Safari you should be able to use this feature to open all the lost windows.