Do I need the download attribute to create a href to download zip and rar files

I have been told to make a link download a file I use:-
<a href="/images/filename.zip" download>click here</a>
But seems if the file is a .zip or .rar it automatically gives download dialogue without the download attribute. My question is whether it is safe to just give a link to a zip or rar file to download it or if there is a good reason to include the download attribute, maybe it is browser dependent, maybe less browsers support it, maybe it is deprecated - any advice please?

Since the browser will never (so far as am aware) be able to open a .zip or .rar file, the download attribute will make no difference.

1 Like

That was my guess but wanted confirmation, so is it a cross browser feature - if you can’t open a file - offer it as download ?

Not really

That is what a browser will do anyway (without the download attribute).

What the download attribute does, is tells the browser to download something that it would normally display - like an image file. It’s not something I have ever used.

1 Like

Sorry, that’s what I meant, It’s a cross browser feature that without the download attribute, if it can’t open it will offer as download :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.