Discussions » Creation Requests

Copy URLs of all open tabs in each window

§
Posted: 27 Maret 2017

Copy URLs of all open tabs in each window

I need a way to copy all the URLs of my open tabs at once.

I open a LOT of tabs and often use new windows for different content (currently, I have 5 tabs open in one window about types of writing tools and what a pencil's number means, one window of 12 tabs of online articles on cracked.com, etc.
Because I have only so much battery life on my laptop, when I cant finish my internet activity, because of reasons, I prefer to copy the URLs down on to a notepad and Power off; instead of running down the battery-life (just so I can get back to it hours or days later).

If there was a script to do this all at once, so I can copy all my open tabs' URLs to the clipboard or something; it'd make things a lot easier, especially if you can make it so I can copy URLs separately for each window I have open.

§
Posted: 28 Maret 2017

This doesn't seem easy to do with a script, since the script executes independently in each tab. Can you find an extension that has this feature?

https://addons.mozilla.org/firefox/extensions/

I should note that if your session history is working normally, the recovery.js file will have a list of open tabs for each non-private window. This is a local file, so scripts might not be able to read it, but as an example of how to extract the URLs, I can point you toward a bookmarklet. Note that the relevant file(s) are in a folder named sessionstore-backups in your profile folder. https://support.mozilla.org/t5/Install-and-Update/Profiles-Where-Firefox-stores-your-bookmarks-passwords-and-other/ta-p/4608

One-time Setup:

(0) Install the "Session Extractor" bookmarklet (see the instructions in the top bar of the page for how to install it):

https://www.jeffersonscher.com/res/sumomarklets.html#SessExtr

To Extract the URLs:

(1) Create a copy of the session history file you want to mine for URLs and rename it with a .json extension.

For example, right-click the recovery.js file, choose Copy, then right-click a blank area of the folder and choose Paste.

Note: By default, Windows hides the .js extension. This is all easier if you can see it. http://windows.microsoft.com/en-us/windows/show-hide-file-name-extensions

Right-click > Rename the recovery - Copy.js file to recovery.json (or recovery.txt if you prefer).

(2) Open the recovery.json file in a Firefox tab. Either drag the renamed file and drop it on an existing page to load the json/txt file in its place, or right-click the file and choose Open With and use Firefox.

(3) In the tab displaying the session history file, click the bookmarklet button to run the script. This should generate a new page listing the URLs of each open tab from the file. You can select and copy this list and paste it somewhere for safekeeping, and/or you can just use the links now.

Unfortunately, if you want to save that page "as is" (as an HTML page), there's an extra step: press Ctrl+U to launch the "view source" page, and save that as a .htm or .html file. For some reason, saving the original page gives you the original session file instead of the formatted list of links.

§
Posted: 31 Mei 2017

An easy way to do this would be to just bookmark your session and then reload that session, without having to go through the trouble of copy and pasting each individual links to save and open them.

In firefox, right-click a tab and select "Bookmark All Tabs...", then create a new folder for it. Usually I'd place the folder in the bookmarks toolbar for easy access.

When you open up firefox again, just right click the folder and select "Open All In Tabs"

Surely such a task wouldn't require the painstaking process of writing a script.

Deleted user 20822
§
Posted: 03 Juni 2017

FlyingNeko said it all. The shortcut is Ctrl-Shift-D.

§
Posted: 16 September 2017
Edited: 16 September 2017

I can use the bookmark to save them(btw thanks FlyingNeko) but i still copy them all at once and put them all in a text document for convenience, since i can group them and label them by what they are. So I can come back a few months later and not be confused by them or have like 12+ bookmarked folders in the way.

Kinda related :
I found this simple way to open a bunch of links at once (after I save them in a text doc) but just as an FYI;
If you create a new ".txt document and copy and paste:





Open Windows






into the text doc, then convert it to a ".html file it lets you open lots of urls at once.(just remember to keep each link on a separate line in the window)

Deleted user 20822
§
Posted: 21 September 2017

Weird solution. In fact, you can do grouping/labeling with the builtin bookmark manager. (Ctrl-Shift-B)

§
Posted: 21 September 2017
Edited: 21 September 2017

I realize this particular question was given a better solution, but I feel like answering the original question.

You can do this by having a single userscript that runs on every page. At the start of every page load it would run some logic:

if (currentPage.url is "example.com" and currentPage is not topPage) {
    GM_setValue("urlList",
        JSON.stringify(
            JSON.parse(
                GM_getValue("urlList")
            ).push(topPage.url)
        )
    );
} else {
    create hidden iframe to example.com and append it to the body
    window.addEventListener("beforeunload", {
        send message to example.com iframe to remove this url form the list
    });
}

Using window.postMessage() and GM_(g|s)etValue() you could indeed keep a list of active tab urls.

§
Posted: 22 September 2017
Edited: 22 September 2017
> I need a way to copy all the URLs of my open tabs at once.

I'd advise you this Firefox addon: Tab Mix Plus; it can save/restore a number of browser sessions with user-defined names

GM_setValue

GM_setValue - how many megabytes of HD it takes now, for each item?

Post reply

Sign in to post a reply.