How to copy the download url to clipboard in firefox?

It depends on how the download is set up.

With certain downloads, the download is initiated with a form GET/POST. So if you look at the final download button's form action, you'll see the download URL.

In other cases, the download is initiated by a redirect (e.g. a PRG or a JavaScript redirect that receives the download URL via an XHR request), in which case, you can use Firefox's Tamper Data add-on to find the download URL in the HTTP traffic, or you can just right-click on the download in Firefox's download manager and Copy Download Link.

But there are some sites that use a single-use URL, or a cookie containing a single-use token, that prevent multiple download attempts, so capturing the download URL via the HTTP request is useless. In such cases, you need to look at the page source to see where you can capture the download URL before the download is initiated. Often, you can find the download URL and/or security token in the page's JS. Otherwise, it's typically found in the response from an AJAX service that the JS requests. Or, you may have to analyze the JS source and watch specific variables to capture all the download request components without actually triggering the download.


You can install Firefox's FlashGot addon. It will add extra option to this popup-dialog. And you even can customize it - go to FlashGot Options dialog and press "Add" button to add custom "Download Manager", which actually can be any script file to do whatever you want.

Examples:

Windows: select bat-file with single-line command echo %1|clip in it to copy download url to clipboard.

GNU/Linux: this script would do the trick:

#!/bin/bash
echo "$@" | xclip -selection clipboard