14

I've been trying to find a method to export all my currently open tabs in the Android Firefox browser. Unfortunately this seem impossible from default browser installation and very hard to do from command line as the SQLite3 database that Firefox is using, contains too many tables and hard to find the right query.

Apparently this is possible for Google Chrome using THESE hacks.

I would like to have each URL on a separate line in a text file.

4 Answers 4

7

Note: this solution requires a rooted Android.

In a terminal emulator app, execute:

(Requires Busybox if running Android 5.1.1 or below. For Marshmallow, remove the term busybox from the following command.)

su
content query --uri content://org.mozilla.firefox.db.tabs/tabs/ --projection url | busybox cut -d '=' f 2 > /sdcard/firefox_tabs.txt

Explanation of the second command:

  • content query: to query a Content Provider
  • org.mozilla.firefox.db.tabs: a content provider from Firefox.
  • --projection url: list data from the url column only

(Click image to enlarge)

IMG:

Or if you have the sqlite3 tool in Android, then you can do:

su
sqlite3 /data/data/org.mozilla.firefox/files/mozilla/*.default/browser.db "SELECT url FROM tabs ORDER BY position" > /sdcard/firefox_tabs.txt 

I've assumed that you have a single Firefox profile and its name has not been altered. If you've a multi-profile setup or if you did change the profile's name, then instead of *.default provide the correct name of the profile of whose tabs you want in your list.

2
  • Tested on Firefox v45.0.2.
    – Firelord
    Commented Apr 27, 2016 at 16:55
  • 3
    file path might change as of 2018: myphone:/data/user/0/org.mozilla.firefox/files/mozilla/1...f.default
    – TiloBunt
    Commented Apr 9, 2018 at 5:10
7

On Android system you can use Termux (No root required):

  1. Navigate in Firefox to URL: file:///data/data/org.mozilla.firefox/files/mozilla/
  2. Choose the link of ***.default folder of your profile
  3. Choose the sessionstore.js file
  4. Copy content of this file and save it in sessionstore.js file on local storage
  5. Run the command in Termux to output your tabs urls:

    cat ~/storage/shared/sessionstore.js | sed -n 's@{\"url\":\"@&\n@g; s@\",\"title\"@\n@gp' | sed '/^[:{]\"/d'
    

    Or, this command to save your tabs urls in file sessionstore.txt on your local storage:

    cat ~/storage/shared/sessionstore.js | sed -n 's@{\"url\":\"@&\n@g; s@\",\"title\"@\n@gp' | sed '/^[:{]\"/d' > ~/storage/shared/sessionstore.txt
    
1
  • UPDATE: While I thought at first that this would work, it actually doesn't: Copying the sessionstore.js's content won't work if the file is sufficiently large. In that case, the clipboard will only contain the first X characters of the file. Not sure if this is caused by Firefox or by Android but in any case it doesn't work. Unfortunately, Firefox for Android doesn't provide a "Save page as…" or "Save target as…" feature, so simply "downloading" the file is not possible, either. Can't make this shit up.
    – balu
    Commented Jun 25, 2020 at 17:11
6

Currently, if you open the list of tabs, there's simply a "Share All Tabs" button and you can easily save that as a text file.

2
  • This works! I could share as a Signal message for example. It was a really long list but worked smoothly, amazing! 😍
    – Joël
    Commented Feb 20, 2022 at 21:15
  • As of 2024, this should be the accepted answer!
    – balu
    Commented May 4 at 14:49
5

Apparently there is an Android specific Firefox browser plug-in called Tabs Backup. This seem to work like charm! It places a text file in /storage/emulated/0/Android/tabs_backup/ (Aka. /sdcard/Android/tabs_backup/) called backup_DDMMYYY_hhmmss.txt.

However, it would still be interesting to know how to do this from command line.


UPDATE: 2018-08-15

Since some time back, Tabs Backup no longer works for the recent versions of Android Firefox. Instead, use Tabs Export. You also need a separate plugin, to import Tabs.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .