Open PDFs in SharePoint 2010
By default SharePoint 2010 prompts you to save PDFs instead of open them in the browser. This can be very irritating for the website visitors forcing them to save the PDF files locally on the computer even though the document is read only.
The main culprit for this behavior is SPWebApplication.BrowserFileHandling property available on SharePoint 2010 which gets or sets a value that controls how files are treated in the browser.
“Strict” specifies that MIME content types which are not listed in AllowedInlineDownloadedMimeTypes are forced to be downloaded. “Permissive” specifies that the HTML and other content types which might contain script are allowed to be displayed directly in the browser.
But, how do we change this? Easy.
1. Go to SharePoint 2010 Central Administration >> Application Management >> Manage Web Applications
2. Select your web application >> Click General Settings on the ribbon
3. Scroll down to Browser File Handling and select “Permissive” >> click OK
Also, the same result can be achieved using PowerShell.
$WebApp = Get-SPWebApplication http://yoursite If ($WebApp.AllowedInlineDownloadedMimeTypes -notcontains "application/pdf") { Write-Host -ForegroundColor White "Adding PDF MIME Type..." $WebApp.AllowedInlineDownloadedMimeTypes.Add("application/pdf") $WebApp.Update() Write-Host -ForegroundColor White "MIME type has been successfully added!" } Else { Write-Host -ForegroundColor Red "PDF MIME type has already been added. Good try." } |