This JavaScript bookmarklet allows you to download all the links (URLs) from a webpage as a CSV file. Follow the steps below to set it up and use it:
-
Open your browser.
-
Go to the Bookmark Manager.
-
Create a new bookmark.
-
Set the bookmark name, for example:
Download Links
. -
Copy the following code and paste it into the URL field of the bookmark:
javascript:(function() { var links = document.querySelectorAll('a'); var urls = Array.from(links).map(link => link.href).join('\n'); var csvContent = 'data:text/csv;charset=utf-8,' + encodeURIComponent(urls); var a = document.createElement('a'); a.href = csvContent; a.download = `links_${Date.now()}.csv`; a.click(); })();
-
Save the bookmark.
-
Open any webpage.
-
Click on the new bookmark to download all links on the page as a
.csv
file.
- If you save the bookmark as
Download Links
and open a webpage, clicking the bookmark will generate a file named something likelinks_<timestamp>.csv
containing all the links on that page.
- This script extracts all
<a>
tags on a page and theirhref
attributes. - The downloaded file will include one URL per line.