In Firefox - across all tabs: How do I list all open URL's of all open browser tabs across all open browsers, using code external to the browser?
---
If I open multiple tabs, or additional browsers with tabs and then I shutdown my machine, or it crashes or I kill all processes (.exe's), the next time I launch the browser, all tabs will be re-opened in one browser window, or multiple browser windows, as it existed before shutting down.
Where is this information stored? specifically, where are the URL's stored so that this is possible?
1) I need to programatically get access to all URL's currently open in all tabs in all running browsers for a given profile when the browsers/tabs are up and running
2) or not: if they are all shut down (the data is stored somewhere in the profile directory in some file or DB, so that the next launch will open all URL's)
---
I would like to get access to all open or stored URL's through bash (cygwin), Python, Java or Rust, some language running on the machine accessing files in the profile directory (code running external to the browser).
The session restoration is performed by the
sessionstore
component. An high level overview of the startup restoration process is described here:As we can see, it mentions the
SessionFile
. Looking for that file, takes us at this definition, which suggests session information is stored in thesessionstore.jsonlz4
file, which is a utf-8 encoded JSON file, compressed with lz4.Unfortunately, the lz4 compression used does not work with standard tools, but there's some good discussion on how to work around that on Superuser (e.g. skip the first 8 bytes of the file).
Another possibility is to create a WebExtension and perform Native messaging with your executable. WebExtensions can enumerate open windows and tabs and get their URLs, if given the appropriate permissions.