Question

My site is developed in SharePoint 2010.
In my Testing site,
<a href="file.pdf" target="_blank">Download File</a>

when click on the above a tag, file opens directly in browswer(IE/Chrome/FireFox)

But same a tag is used in my Live site where it ask to save file(In IE) or gets downloaded(in Chrome).

Was it helpful?

Solution

For link on file use standard SharePoint download.aspx page.

<a href="http://yourSite/_layouts/download.aspx?SourceUrl=http://pathToFile" target="_blank">Download File</a>

Download.aspx will read the content of the file you send as the SourceUrl, and render it back to you on the HTTP response.

Hope that helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top