How to copy URLs of multiple Firefox tabs without installing an extension
It’s easy, once you know you can
Once upon a time, I ran across an experimental project called TabFS, which mounts browser tabs as a filesystem. This seemed like such a cool idea! Ever since, I have wanted a way to interact with tabs programmatically. But the main thing I’ve wanted to do is be able to grab the URLs of some or all of my open tabs, and paste them into a text file.
Each time I have looked into this before, it hasn’t been possible without installing an extension. And I don’t like installing extensions.
I often have text files of URLs, one per line, related to some project. Often I want to be able to open them all in Firefox (easy in Helix editor with %s\n<ret>xgf [1]) while I’m working on the project, close ones that aren’t relevant any longer and follow new leads, and then save the updated list when I’m done, without interacting with bookmarks (my graveyard for URLs that are “interesting” and “relevant” and I’m definitely never going to visit again).
Another common use-case is when I want to copy the URLs for a group of tabs and pass them to a script (in this case, my Ghost API markdown export script).
Today, I discovered that it’s not just possible, it’s easy! It looks like this feature was added in v152.0a1, 4 months ago.
- Select some tabs (right click on a tab, then click “Select all tabs”; or click on one tab, then shift click on another to select range, or ctrl click to cherry-pick individual tabs)
- Right click on tab, or open File menu
- Click “Share”
- Click “Copy n links”
Watch:
You can do steps 2-4 in one go by pressing (in sequence) Alt f h l
I want to be able to do everything with the keyboard. However, although you can cycle through tabs and move tabs with keybindings, weirdly, there doesn’t seem to be a Firefox keybinding for selecting tabs, or for opening the tab right click menu (Shift+F10 opens the page right click menu, even if tabs are selected and the mouse is hovering over a tab).
If you paste these tabs into a rich text field, they will be links with titles, but if you paste them into a plaintext editor, they will be plain URLs, one per line!
%select buffer,sopen split dialog,\nsplit delimiter, <ret>/Enter split selection on delimiter,xextend selections to whole line,gf(g)oto (f)ile, which opens URLs in the browser ↩︎