Download Links

HM5 served us well, now its time has come and it has been replaced... If you have HM5 questions, please post them here.

Moderators: Alexander Halser, Tim Green

Post Reply
matt harris
Posts: 27
Joined: Wed Apr 22, 2015 4:03 pm

Download Links

Unread post by matt harris »

Hi

I am creating a webhelp and i have put in some links to files for users to download. However if I link to a PDF file instead of offering to download the file directly, it displays it in the browser.

Anyway of inserting a direct download link?


Thanks


Matt
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Download Links

Unread post by Tim Green »

Hi Matt,

Just tell your users to right-click on the link and select download. Most of them should actually know this already ... 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
matt harris
Posts: 27
Joined: Wed Apr 22, 2015 4:03 pm

Re: Download Links

Unread post by matt harris »

Tim, you obviously haven't met our staff :lol:

Really just need a one click option
Simon Dismore
Posts: 454
Joined: Thu Nov 16, 2006 1:29 pm
Location: London, UK

Re: Download Links

Unread post by Simon Dismore »

matt harris wrote:Any way of inserting a direct download link?
These browsers support the download attribute in links. This forces the document to be downloaded rather than displayed in the browser. It will default to the same filename as that on the server, or you can provide a custom one. Either way the user will be able to change the name. As far as I can see, browsers like IE and Safari that don't support download silently ignore it.

I found a hack to add this attribute by changing the Internet link to a Script link and using mismatched quotation marks, as in the following screenshot:
hacking-download-attribute-into-scriptlink.png
That hack works OK in H&M 7.0.8 but might not work in H&M 5 (which is what this forum is for) or in future builds. Alternatively, you could implement this either by manually editing your topic files each time you publish them, or by using Insert HTML code object to create the link manually, like the code below.

Code: Select all

<a href="prospect-theory.pdf" download="my-custom-filename.pdf" class="weblink">
Prospect Theory: An Analysis of Decision under Risk (Kahneman & Tversky 1979)</a>
By the way, are you really using version 5 of Help & Manual? The latest release is much better in my opinion.
You do not have the required permissions to view the files attached to this post.
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Download Links

Unread post by Tim Green »

Thanks for this, Simon!

I always hesitate to post suggestions like this that aren't supported across all browsers, so the caveats do apply here... 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
matt harris
Posts: 27
Joined: Wed Apr 22, 2015 4:03 pm

Re: Download Links

Unread post by matt harris »

Thanks for your help gents

Yes Simon, I am really am using version 5 :(

As you suggested I couldn't get your hack to work in V5, however I did manage to achieve what I wanted by using the code you gave an an HTML Code object plus a little amendment to show the link as a button instead of text.

<a href="filename.pdf" download=" my-custom-filename.pdf " class="weblink"><button>Download</button></a>

Matt
Post Reply