How to copy multiple urls hidden under texts, by selection in webpages?
I would like to copy urls in a webpage, which are hidden under some texts.
For example the urls under the titles in the table of contents in http://download.racket-lang.org/releases/6.4/doc/guide/. I would like to avoid clicking each link to copy each url, because there are too many urls to click.
Thanks.
Kaikki vastaukset (5)
There's not a built-in feature for this.
You could try an add-on, or run a script against the page (for example, a bookmarklet). Since add-ons can put content directly onto the clipboard, that saves a step compared with a script that exposes the links for easier copying. On the other hand, a custom script can do whatever you want in the way of extraction and display, so sometimes it's the better approach.
Examples of add-ons I found in a search (there are more...):
Also, your Firefox identified itself to the forum as version 40. Is that correct?
Version 40 is not secure; Mozilla discloses security flaws after each new release. Is something holding you back from upgrading to Firefox 45? Please let us know so we can suggest solutions or workarounds.
If Help > About Firefox shows Firefox 45.0.1, you may need to clear the preference that is misreporting your version number. See: How to reset the default user agent on Firefox.
See also Link And Forminfo:
This extension adds a Links tab to the Page Info window where you can select multiple links in the usual way via Shift and Ctrl and copy the selected links to the clipboard via the right-click context menu.
Thanks. How do you write a script?
jscher2000 said
There's not a built-in feature for this. You could try an add-on, or run a script against the page (for example, a bookmarklet). Since add-ons can put content directly onto the clipboard, that saves a step compared with a script that exposes the links for easier copying. On the other hand, a custom script can do whatever you want in the way of extraction and display, so sometimes it's the better approach. Examples of add-ons I found in a search (there are more...):
Timmm said
Thanks. How do you write a script?
That's sort of a big subject, but here's an example. You're going to save this as a bookmark somewhere convenient, either on the Bookmarks Toolbar or the Bookmarks menu. Then after selecting links in the page, you click the bookmark and a script extracts the links from the selection and displays them in a textbox you can copy from. Nearly everything about this can be customized.
(1) Select and copy this script (it's all one line):
javascript:var r=window.getSelection().getRangeAt(0); if (!r.collapsed){var d=document.createElement("DIV"); d.appendChild(r.cloneContents()); var L=d.querySelectorAll('a[href], area[href]'); if (L.length > 0){d.innerHTML="<textarea id=\"ListOLinksTA\" style=\"width:100%;height:100%;color:#ffc;background-color:#006;\"></textarea><button onclick=\"this.parentNode.remove();return false;\" style=\"position:absolute;right:1em;\">X</button>"; var s="Links:"; for(var i=0;i<L.length;i++){s+="\n\nText:"+L[i].textContent+"\nURL: "+L[i].href;}; d.setAttribute("style", "position:fixed; width:80%; height:80%; top:5%; left:5%; color:#fff; background-color:#000; padding:1em;"); document.body.appendChild(d); document.getElementById('ListOLinksTA').textContent+=s;}} void 0;
(2) Right-click a convenient place on the Bookmarks Toolbar or Bookmarks Menu and choose New Bookmark
(3) Paste the script into the second box, labeled Location
(4) Give your button a brief name like SelectionLinks and click the Add button
Your bookmarklet is ready to test. One negative is that in order to copy the links, you lose the selection. An alternate way to do it would be to list the links in a new tab instead. (But not tonight...)