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