6

I have kept files in site assets and created hyperlinks to the files (which may be PDF or word ). When i click on the link it opens up in the browser. How do i force it to download ?

  • The answer is what I would like to do but how can I accomplish this with SharePoint Online. The central admin is a bit different then on premise. – Kerilee Baehre Jul 20 '17 at 18:05
  • @KerileeBaehre If you can't achieve the solution in the first answer you could try the answer I provided. It requires some work to get the links but it should work. – JacobCaldwell Jul 20 '17 at 22:30
4

One solution to this is you could create a download link.

This can be done by using the format below to create a download link for the file:

http://company.sharepoint.com/siteName/_layouts/download.aspx?SourceUrl=https://company.sharepoint.com/siteName/SiteAssets/fileName.pdf

You could type out these links manually or you could concatenate http://company.sharepoint.com/siteName/_layouts/download.aspx?SourceUrl= as it will never change with the link of the file you are trying to download.

Note: This will not open the page if that is what you want, it will only download the file.

3

When the header contains noopen the browser will simply download the file instead of opening it directly in the browser. Opening the file locally on the computer will not compromise your websites security. This is a good idea, but terribly annoying for our company intranet users.

Example:

HTTP/1.1 200 OK
Content-Length: 238
Content-Type: text/html
X-Download-Options: noopen
Content-Disposition: attachment; filename=myfile.pdf 

So we need to remove this extra security.

  • Go to Central Administration -> Application Management -> Manage Web Applications
  • Select the web application and click General Settings
  • Scroll down to Browser File Handling, and choose Permissive instead of strict.
  • SharePoint will no longer send the X-Download-Options header, and Explorer 8+ will then not be able to block the opening of the file directly in the browser.

This seems to be an all or nothing situation. I have not seen a way to control it so that you can for instance stop forcing the download of just the pdf files.

You can also use powershell to change to permissive for all web applications:

Get-SPWebApplication | ForEach-Object {$_.BrowserFileHandling = “permissive”; $_.update()}

You can view all web applications browser file handling using powershell as well:

Get-SPWebApplication | Select url, browserfilehandling

It seems some people still have problems with this even after making this change.

Please refer SharePoint download file instead of opening in browser

  • if it affect the whole sharepoint site then this is going to be a problem. There are situations where pdf's needs to be opened directly in the browser. Is there anyway to do this on one site of site pages ? using javascript or something ? – Rinu Aug 31 '16 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.