Showing posts with label HTML files. Show all posts
Showing posts with label HTML files. Show all posts

10 January, 2012

Opening HTML Files in Sharepoint 2010

In SharePoint 2010 I have created a Library in which I have placed an Html document and related file system to go with the document.  Under Library Settings / Advance Settings I have selected (Open in Browser). However, when I click on the file to open it in SharePoint it does not open in the browser but opens up a dialogue box to save the file locally.


Requirements: We wanted the ability to open the HTML document directly within the browser. 


Multiple Requirements:
1. upload html files to a sharepoint library: in document library we can add html files, but the problem is when i open that html file in the library a popup message box appears asking to save the file. is there a way to open these html files in a browser like documents are open in word.

2. Asking to save file when try to open it from sharepoint: When I try to open the files(.html,.xml.....) which are uploaded to sharepoint,Its not getting opened directly instead a pop up window to save the file is coming.

3. In a document library when I check out a Word document, I get prompted "You are about to check out ___" with the option to use Local Drafts folder.  I can then open the document from Local Drafts and upon saving, I get prompted to check in.

4. If you have converted Word document to HTML file and uploaded it to SharePoint.  Now I would like to make modification to the new HTML file and save it through SharePoint.  However, it is not possible because it the HTML file doesn't "save" option, only "save as" option. 

Resolution:
By default, Sharepoint 2010 is blocking the ability to open HTML documents directly from a document library. 

However this can be changed by adjusting the browser file handling option. The option is located here:

1. Central Admin\Application Management\Manage Web Applications.
2. Select General Settings for the specified web application
3. For Browser file handling, select permissive. The default is strict​

Detailed Explanation as why it happens:

This is intentional behavior. In SP2010 Microsoft has tightened up security for people with contribute access. Previously, a malicious user could upload a file with script in it that would get run as whoever browses to the page ie. an admin. In 2010 where we have a javascript object model, this would be a big problem if we didn't have this restriction in place.
Browser File Handling  
Specifies whether additional security headers are added to documents served to web browsers. These headers specify that a browser should show a download prompt for certain types of files (for example, .html) and to use the server's specified MIME type for other types of files.
Permissive Specifies no headers are added, which provides a more compatible user experience. 
Strict Adds headers that force the browser to download certain types of files. The forced download improves security for the server by disallowing the automatic execution of Web content that contributors upload

If you have any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues, thank you