I'm working on an HTML5 output project and I've got .xsd files that my team wants users to be able to download. So I include the .xsd file in my project and created a hyperlink to the file. When clicked it opens in a new browser window or tab, or if a user right-clicks they can select Save As... That works fine.
My team though, wants a user just to be able to click the link to start a download. I'm pretty sure that can be done, I just don't know how... Ideas?
Thanks.
download a file from a hyperlink
-
- Propeller Head
- Posts: 36
- Joined: Tue Jul 10, 2012 9:31 am
- Location: Milwaukee Wisconsin
-
- Propeller Head
- Posts: 77
- Joined: Wed Jul 10, 2013 12:34 pm
- Location: Salt Lake City
- Contact:
Re: download a file from a hyperlink
Have you tried the download attribute? This has worked for me in the past.
https://www.w3schools.com/tags/att_a_download.asp
I don't think there is an option in the Flare interface for this, so you'd need to do it in your HTML code. It would look something like this:
https://www.w3schools.com/tags/att_a_download.asp
I don't think there is an option in the Flare interface for this, so you'd need to do it in your HTML code. It would look something like this:
Code: Select all
<a href="MyXSD.xsd" download="MyXSD.xsd">Download XSD file</a>
-
- Jr. Propeller Head
- Posts: 4
- Joined: Fri Feb 02, 2018 9:32 am
Re: download a file from a hyperlink
I tried this with a Flare (version 2018) HTML5 target and did not get a download action to happen in the browser. I also found that the Flare editor sees a 'download' attribute without a value as an error, although it is valid HTML:
I guess to do this reliably requires some JavaScript, as shown here http://html5-demos.appspot.com/static/a.download.html, which involves generating a 'blob URL' (https://stackoverflow.com/questions/308 ... it-is-used).
Code: Select all
<a href="../Resources/Download/test.txt" download>test.txt</a>
Re: download a file from a hyperlink
That's because the Flare editor is using XHTML, not HTML. Attributes in XHTML can't be minimised, so they must have a value, even if it's blank like attribute=""phillipkent wrote:I also found that the Flare editor sees a 'download' attribute without a value as an error, although it is valid HTML:
https://www.w3schools.com/htmL/html_xhtml.asp
Re: download a file from a hyperlink
Did anyone get this to work? I am trying to do the same thing.
- Adding JPG and SQL files as external resources (the files are located in \Resources\Downloads).
- Inserting a hyperlink to an individual JPG/SQL file in a topic.
- Adding the download attribute to the link.
Result: the linked file opens directly in the browser as either images or plain text instead of being downloaded.
I have tried the following values for download. All with the same result.
The logotype has to be added to the image library to make it selectable in this dropdown. <a href="Resources/Downloads/logo.jpg" download>Click here to download the logotype</a>.
The logotype has to be added to the image library to make it selectable in this dropdown. <a href="Resources/Downloads/logo.jpg" download="">Click here to download the logotype</a>.
The logotype has to be added to the image library to make it selectable in this dropdown. <a href="Resources/Downloads/logo.jpg" download="logo">Click here to download the logotype</a>.
The logotype has to be added to the image library to make it selectable in this dropdown. <a href="Resources/Downloads/logo.jpg" download="logo.jpg">Click here to download the logotype</a>.
The logotype has to be added to the image library to make it selectable in this dropdown. <a href="Resources/Downloads/logo.jpg" download="true">Click here to download the logotype</a>. (Just for the sake of it.)
Is there something wrong with the path? The files open, so there shouldn't be, but I am starting to wonder ... The question remains: How do you force a download?
- Adding JPG and SQL files as external resources (the files are located in \Resources\Downloads).
- Inserting a hyperlink to an individual JPG/SQL file in a topic.
- Adding the download attribute to the link.
Result: the linked file opens directly in the browser as either images or plain text instead of being downloaded.
I have tried the following values for download. All with the same result.
The logotype has to be added to the image library to make it selectable in this dropdown. <a href="Resources/Downloads/logo.jpg" download>Click here to download the logotype</a>.
The logotype has to be added to the image library to make it selectable in this dropdown. <a href="Resources/Downloads/logo.jpg" download="">Click here to download the logotype</a>.
The logotype has to be added to the image library to make it selectable in this dropdown. <a href="Resources/Downloads/logo.jpg" download="logo">Click here to download the logotype</a>.
The logotype has to be added to the image library to make it selectable in this dropdown. <a href="Resources/Downloads/logo.jpg" download="logo.jpg">Click here to download the logotype</a>.
The logotype has to be added to the image library to make it selectable in this dropdown. <a href="Resources/Downloads/logo.jpg" download="true">Click here to download the logotype</a>. (Just for the sake of it.)
Is there something wrong with the path? The files open, so there shouldn't be, but I am starting to wonder ... The question remains: How do you force a download?
Re: download a file from a hyperlink
Dafra08 wrote: Is there something wrong with the path? The files open, so there shouldn't be, but I am starting to wonder ... The question remains: How do you force a download?
Not sure if you found a way to do this in Flare yet, but I believe when I looked at this in the past I discovered that the browser chooses how to handle the file - as in it's set on the client side. User's should be able to right-click to select to download instead of open the file if open is the default behavior. I personally, couldn't get the download attribute to work at all in Flare.
-
- Sr. Propeller Head
- Posts: 238
- Joined: Tue Mar 17, 2009 10:41 pm
Re: download a file from a hyperlink
Nomthe download attrib will not work in Flate at all. It’s been a known issue.
Fill out a enchame t request and maybe it can be addressed in a future version
Fill out a enchame t request and maybe it can be addressed in a future version
Rick Ferrell
____________________________
Former Flare and Robohelp Support
____________________________
Former Flare and Robohelp Support
Re: download a file from a hyperlink
I got this to work on my project by searching dev boards and finding out about an .htaccess file.
So I created one in my published repository that just contains:
You should be able to add additional lines for any kind of file type you want to auto download. Then adding the download="" attribute should actually work for those files. Hope this helps because it was driving me crazy as well and this has 100% solved it for my use case!
So I created one in my published repository that just contains:
Code: Select all
AddType application/octet-stream .txt
AddType application/octet-stream .pdf