Add Downloadable Files
To provide downloadable files in your content, you need to add external links pointing to those files on your server, and a script that turns external links into downloadable files.
Add Download Link
A download link is an external link with the role
attribute set to download
. Download links will not work without a script that turns them into downloadable files.
To add a download link in a topic:
Select the topic or component in the Content Manager to open it in the Editor.
Alternatively, you can Create a Topic and edit that.
Position the cursor where the link is to be inserted.
Tip
Alternatively, highlight the text that you want to use as link label.
Select the Insert tab in the Toolbar.
Select Link and choose External link.
Enter a Link label and Link target.
Select Insert.
Select the
link
in the Element Structure Menu and choose Go to element.Add the
role
attribute in the Element Attributes Panel and set its value todownload
.Select Save.
Convert Links into Downloadable Files
Download links will not work unless you add a script that turns them into downloadable files:
Use a text editor or code editor for creating (or updating) the JavaScript file.
Add the following script:
$(document).ready(function () { var link = document.getElementsByClassName('link download')[0]; $(link).attr("download", true); });
Save your JavaScript file making sure it has a
.js
filename extension.