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