Friday, May 17, 2019

I want to make the Files to get Downloaded instead of Opening in a New Window in the Browser

Hey Everyone..!

Hope you all doing well.

Many Developers would have came across this small issue while developing a site, where you will get requirements from business that they don't want their PDF to be open in a new window as they takes time if their sizes are more than 10MB, so they will ask you to make the document to get downloaded automatically instead of opening in a new window. 


So I've a simple solution for it.


Example: 

I've a table with many rows, containing hyperlink data, which opens in a new window on clicking, but i want them to get downloaded automatically 

<a href="https://aaaaaaaaaaaaaaaaaaaaaaaa/My Document.pdf" target="_blank">My Document</a>

Solution
There is a  HTML5 attribute "download". with which we can easily download all the files

Source Code

<a href="https://aaaaaaaaaaaaaaaaaaaaaaaa/My Document.pdf" download="My Document">My Document</a>

1 comment:

How to create a SharePoint List in Tamil | SharePoint Online List in Tamil

  In this video i have given you a short overview on SharePoint List and different ways to create a list, How to create a SharePoint List in...