Forcefully download Link

How can I create a Link, that forcefully begins a file Download?

Example:
In our xwiki are lots of .TXT (or similar Text based files) Files linked.
By a regular xwiki Link, choosing such a Link, just opens a new Browser Tab which shows the Content of the Text File.
In my case, this is not the preferable behavior. I need a Download - not a Browser inline preview.

In HTML there is the possibility, to make a Link forcefully to a download Link.
Like:
{{html}}
Click here to download the Textfile!
{{/html}}

For a standard xwiki link, I see no parameter or Option to do so as well.
By using the HTML Macro, it is … ok, but I looked for a nicer way in xwiki to open up directly a download dialog, because not every regular User knows what HTML is, or what it can do.

I found this Topic:
https://forum.xwiki.org/t/force-an-attachment-to-download/1136/7
But like the last Post says, it doesnt work…

Are there any Ideas, how to handle that?
We are using xwiki 9.11

Thanks for your help!

AFAIK only Chrome respect this parameter. At least Firefox does not seems to care.

You can pass any parameters you want to the link in wiki syntax:

[[Click here to download the Textfile!>>attach:SomeTextFile.txt||download="SomeTextFile.txt"]]

See http://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiSyntax/#HLinks for more details about link syntax.

I’ve read the Syntax documentation but It wasn’t clear to me that all html attributes were allowed, thanks for clearing that up!

Just a heads up: According to https://caniuse.com/#search=download, Firefox does supports this attribute. However, it just supports just same-origin download.

The download action supports a force-download request (query string) parameter. But you need to add it to the attachment URL:

{{velocity}}
[[Download>>path:$doc.getAttachmentURL('someTextFile.txt', 'download', 'force-download=1')]]
{{/velocity}}