Create one-click, direct download links

1–2 minutes

Update 6/19/21: The post below requires use of html and, in SharePoint specifically, would require the classic experience. You may instead be looking for how to create direct download links with JSON in modern SharePoint libraries.

You’re sending an email, or creating a new page on your intranet instructing people to download a file.

You can always just link to an image or document and then have people figure out how to download it themselves. But methods of downloading vary by browsers and versions and content types (images vs PDFs, for example) so it’s much easier to just provide a link to users that automatically initiates the download for them regardless of context.

Note: This downloads to their default download folder/location.

Using a direct download link will save them some time by providing a one-click download option. No need to right-click-save-as, or save-and-name.

Simply add the word “download” after the href URL before closing the tag.

...www.sharepointlibrarian.com" download>Download here!</a>

For example, if I want people to download the print icon below I would link it in my HTML-formatted email or on my webpage/intranet using the script following it. The red text could be an image (download button?) or text like “Download the icon.”

<a href="/wp-content/uploads/2019/01/print.png" download><img src="https://natechamberlain.com/wp-content/uploads/2019/01/print.png"></a>

And for a PDF I don’t want opened in the browser, it might look something like

Download the latest newsletter

<a href="/wp-content/uploads/2019/01/DownloadMe.pdf" download>Download the latest newsletter</a>

Discover more from Nate Chamberlain

Subscribe to get the latest posts sent to your email.

7 responses to “Create one-click, direct download links”

  1. Hondaly Avatar

    Thank you, thank you. Exactly what I was looking for.

  2. Ben Avatar
    Ben

    unfortunately, it doesn’t work for excel files. They always open in a tab even with this attribute. Anyway around that?

  3. Damsinier Avatar

    I never knew I could find this on this internet, I truly find this helpful, thank you for sharing.

  4. Peniel Rita Avatar

    Thanks mate.
    This was helpful

  5. […] previously blogged how to create one-click direct download links, but that message was exclusive the the classic experience (or any in which we could use classic […]

  6. dcodemaster Avatar

    Sadly, this trick doesn’t work on mobile.

  7. Bismarck Avatar

    Great post Nate, I will use this often. Thanks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Nate Chamberlain

Subscribe now to keep reading and get access to the full archive.

Continue reading