Are there a download file feature?


#1

Hi,

I’m working on a q&d prototype where among many elements I have a button that when clicked on will download a file.
I have tested with “Click” and “Open Link” but it won’t behave how I want it to behave. What I’m looking for is that:

User clicks on button and the file gets downloaded while staying in the same view. I don’t want the link to the url to act like a link to a page that will be loaded in the same window or new tab/new window.

Is this possible with axure?


#2

You could create an animation to indicate that a download has been started, change the colour of the text etc. I don’t believe you can link to a file and have it download from a prototype, but I’ve never tried that.


#3

Thanks for the reply!
Maybe i should clarify. I exported the HTML and have published the prototype, so the prototype is now more a live webpage. But when I click to download a file it will either open a new tab/window and download the file or go to that file in the same window and download.

What I’m looking for is a way to download the file without leaving the page, just keep it as is. :persevere:


#4

I believe you can use Javascript to do this, but I’m afraid that’s outside my experience. Paging @mbc66, who I know has done stuff with JS and prototypes.


#5

Try using an iframe. Set the source of the iframe to the file. I think that might work.


#6

Thanks for the reply!
Yes i tried that later and it worked. But got some feedback before we tried it live, that it might not be allowed from security pov sometimes by the browser. Especially since there are javascript involved.
I don’t know if this is the case but I went along with another approach, and I’ll let you know if it worked;

Instead of setting a https invoke an alert with
javascript:alert(“Hello”);void(0);
instead of a address

The only thing is when editing the string those quotations gets autocorrected into something that will not make it work. A copy paste of the above will work however, so we (me and my colleague that are fiddling with this) will try this and se if it even works :slight_smile:


#7

If you’re on a Mac, you can turn off the Autocorrect function (look for ‘smart quotes’) that causes that issue.


#8

I’m not sure what your plan with alert is, but it won’t download a file for you. It just shows some text.

To the best of my knowledge, the behavior you’re looking for is mostly determined by the headers on the response to the request (and, of course, how the browser chooses to respond to them). What type of file is it? For example, if you have a ZIP file at a given URL and you request it, if it has Content-Type: application/zip then most browsers will download it in the background and not leave the page, like you want. However if it’s, say, a text file and has a Content-Type: text/plain header then usually the browser will try to display it since it can display that content.

So from some quick searching there might be some tricks that will work client side (Axure), but I don’t know which ones will or will not work. If you truly need a consistent experience, it might be worth investigating and properly setting header server-side.

It’s possible setting the type to application/octet-stream server side might work as well.

I’m not terribly knowledgeable in this area, but this is to the best of my understanding. You honestly might be best served by just using Open in New Window if the above isn’t possible for you.


#9

Yeah you are right. The alert just showed a message. But from that we continued with using ( I think) window.open and pointing the url to a hidden iframe (which i could just as easily create in Axure) which then seemed to work as intended. Later i think we need to look into some other solution for this. But for now it works as intended anyway :slight_smile:

Thanks!


#10

just upload a sample file in google drive and get link.
set click or tap > open link > link to external URL with new tab options and past the copied link into URL.
it’s just a prototype not a web-based software :slight_smile:

use a download shape before these.