How to open save dialog box instead of file getting opened in browser for my Sharepoint site

StackOverflow https://stackoverflow.com/questions/23535189

  •  17-07-2023
  •  | 
  •  

Вопрос

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).

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top