Hello,
How can I create a dynamicly generated link? I mean, user clicks on the link, file downloads and the link gets inactive.

Thumbs up

Warning: this is java script just no jquery.
My solution would be to try an onclick event or add an event listener
and in that onclick or event listener, you can set the href attribute of the link to be an empty string.
I will try it myself now.

Thumbs up

Is this what you want to do?
This is an example of what you might want to do. This uses an event listener look at the link and at the script tag.
For best results, use closer to a modern browser.
<!DOCTYPE html>
<html>
    <head>
        <title>Example</title>
    </head>
    <body>
        <a id="specialLink" href="thingToDownload.txt" download >Thing to download</a>
    </body>
    SPAM
        var specialLink = document.getElementById("specialLink");
        var numClicks = 0; //this will count number of clicks
        specialLink.addEventListener("click", function() {
            if (numClicks>=1) { //if somebody clicked the link once, the href attribute will become a random string
                specialLink.setAttribute("href", "fe");
                specialLink.setAttribute("aria-disabled");
            }
            numClicks = numClicks+1;
        });
    </script>
</html>

Thumbs up

Yes, that's basically what I wanted to do. Thanks

Thumbs up

no problem. I realize upon further reflection, that solution was kind of ugly. Glad you found it somewhat useful.

Thumbs up