Allowing Specific File Types To Open In-Browser In Sharepoint 2010

Configuring Browser File Handling

SharePoint 2010 provides administrators fine-grained control over which file types users can open directly within the browser. By configuring browser file handling settings, admins can enable or disable the ability to open certain file extensions in-browser across all SharePoint document libraries and lists.

When a user clicks on a file link in SharePoint, the request is handled by components on both the server and client side. On the server, SharePoint 2010’s implementation of the ASP.NET HttpHandler class handles mappings between file extensions (like .docx or .pdf) to MIME types (like application/vnd.openxmlformats-officedocument.wordprocessingml.document). The HttpHandler then passes the file data and MIME type to the client browser.

On the client side, the browser checks if any plugins or file type associations are configured to handle files of that MIME type. If a mapping exists, the browser opens the file directly within the browser window using the mapped plugin or external application. If no mapping exists, the browser prompts the user to download the file instead.

Common document file types like Microsoft Office files, PDFs, images, and text files can typically be opened directly in-browser if browser extensions like Office Web Apps or Adobe Acrobat are installed. Media files and other arbitrary file types generally need to be downloaded by default for security reasons.

Explaining File Handling for Different File Types

When a user attempts to open a filestored in SharePoint 2010, the handling depends on both server and client side settings:

  • On the server, SharePoint’s HTTP handler maps file extensions to MIME types using configurable file type associations in IIS. Admins can customize these mappings to control MIME types.
  • The client browser receives the file data and MIME type from SharePoint and checks whether browser plugins, helpers, or external applications are registered to handle files of that type.
  • If a file type association exists, the browser opens the file in-browser using the configured handler. Otherwise, the browser prompts the user to download the file.
  • Browser functionality for opening files depends on the user’s client environment including installed browsers, plugins, add-ons and system file type associations.

As an example, consider a native Microsoft Office Word .docx file stored in SharePoint:

  1. A user clicks a link to the .docx file in the SharePoint UI.
  2. SharePoint server maps the .docx extension to the MIME type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
  3. The browser receives the .docx file data and MIME type from SharePoint.
  4. Using the MIME type, the browser checks for configured file handlers:
    • If Office Web Apps is installed and enabled, the .docx will open in-browser using the Office Online handler.
    • If not, and the browser has a native .docx file type association, it may prompt the user to open the file in the desktop Word application.
    • Otherwise the browser prompts the user to download the .docx file.

Examples of File Types that Can Be Opened In-Browser

Here are some common file types users can open directly within the browser if the necessary browser add-ons are installed:

  • Microsoft Office files – .docx, .xlsx, .pptx (requires Office Web Apps browser extensions)
  • PDF files – .pdf (requires browser PDF viewer like Chrome’s built-in PDF viewer or Adobe Acrobat browser plugin)
  • Images – .jpg, .gif, .png, .tiff (opens directly in browser)
  • Text files – .txt, .csv (opens directly in browser)
  • HTML files – .html, .htm (opens directly in browser)
  • XML files – .xml (opens directly in browser)

Advanced media files like videos (.mov, .mp4) and audio files (.mp3) generally prompt the user to download rather than open in-browser by default for security reasons around untrusted external content.

Customizing Allowed File Types

SharePoint administrators can further customize which file types users are allowed to open directly within the browser across all SharePoint libraries and lists. This allows granular control over security and the end user experience.

Steps to Customize Allowed File Types in SharePoint Libraries

Here is an overview of the process to customize allowed in-browser file types in SharePoint 2010:

  1. Navigate to SharePoint Central Administration > Application Management > Manage web applications.
  2. Select the desired web application then choose General Settings from the ribbon.
  3. Under Browser File Handling, click the “Permitted file types” link to view and edit allowed file types.
  4. Add or remove extensions from the allowed list then click OK to save changes.
  5. Alternatively, check “Open in Client Application” to disable all in-browser file types.

Updated browser file handling settings may take up to 30 minutes to propagate throughout SharePoint due to timer jobs.

Enabling Specific File Type Icons and File Handlers

In addition to defining allowed file types globally, SharePoint admins can also configure custom icons and file handlers for specific file types in browser:

  • Upload icon images to SharePoint images library to use for custom file type icons.
  • Define custom file handling mappings in SharePoint Designer by navigating to All Files > _ Layouts > MIME Type Mappings.xml.
  • Map extensions to custom icon images and optional application URLs to launch custom file handlers.

Again, changes can take up to 30 minutes to take effect across your SharePoint environment. Test functionality in a browser after sufficient propagation time.

Sample Code for Adding Custom File Type Associations

The following XML code snippet shows an example format for defining custom SharePoint file type icons and handlers in MIME Type Mappings.xml using SharePoint Designer:

<Mapping>
  <Extension>zip</Extension>
    <MimeType />
  <Icon>_layouts/15/images/zip.png</Icon>   
  <OpenInClient>False</OpenInClient>
</Mapping>

<Mapping >
  <Extension>mp4</Extension>    
  <MimeType>video/mp4</MimeType>
  <Icon>_layouts/15/images/mp4.png</Icon>  
  <OpenInClient>True</OpenInClient>
  <ApplicationUrl></ApplicationUrl>
  <AppTitle>MP4 Video Player</AppTitle>
</Mapping>

In this example, we configure a custom icon for ZIP files but do not enable in-browser viewing. For MP4 video files, we add a custom icon, MIME type, set OpenInClient true to allow in-browser viewing, and supply optional application title text.

Troubleshooting Browser File Handling

If users have trouble opening files directly within the browser, there are several techniques IT administrators can use to troubleshoot and fix browser file handling in SharePoint 2010.

Common Issues When Opening Files In-Browser

Some common issues users may encounter when attempting in-browser file viewing include:

  • File opens unexpectedly in a separate app rather than in the browser tab
  • “Application cannot be found” errors when opening files
  • Generic file type icons displaying instead of custom icons
  • Long delays when opening files before preview displays
  • Browser crashing or becoming unresponsive when viewing or scrolling through files
  • Outdated or insecure browser file handlers launching for particular file types

Troubleshooting these requires a close inspection of client browser settings, SharePoint file associations, and browser plugin behaviors when viewing SharePoint library content.

Fixing Problems with File Type Associations

Some troubleshooting steps for debugging file type handler issues include:

  • Confirm SharePoint MIME types are properly mapped to file extensions on server
  • Check browser plugin health and settings permissions in the browserAdvanced Access
  • Inspect any custom browser file handling override rules at the client level
  • Verify client connectivity and response when opening SharePoint files in-browser
  • Test behavior with browser caching disabled to check for stale icon data

If problems arise only for specific file types, adjusting mappings and re-deploying custom handlers for those types may resolve the symptoms.

Tips for Testing and Verifying Browser File Handling

When troubleshooting or validating custom file handling configurations, admins should test behavior across a spectrum of use cases:

  • Use modern standards-compliant browsers like Chrome and Edge to test baseline behavior
  • Check functionality in older browsers users may still use like IE11 or Safari for regressions
  • Validate performance behaviors like latency, resource utilization, caching with browser developer tools
  • Inspect network traces during file open sequences to identify bottlenecks
  • Simulate read heavy usage by rapidly scrolling through large files to check browser stability
  • Capture HAR files and client-side console logs for unusual JS errors during file handling

Rigorously testing key scenarios that reflect real-world usage patterns allows IT to identify the most impactful issueswith in-browser file handling in SharePoint 2010. Often, problems only emerge under heavy user load which can be simulated via load testing tools.

Best Practices

When configuring and managing browser file handling in SharePoint 2010, IT administrators should adhere to known performance, security and user experience best practices.

Recommended Browser File Handling Settings for Performance

To optimize browser file handling for performance across large SharePoint deployments and high file usage scenarios:

  • Start by disabling in-browser previews for most file types using browser file handling settings
  • Minimize allowed file types to only those needed for business purposes
  • Consider disabling image thumbnails and instead use lower resolution placeholder icons
  • Enforce limits on maximum in-browser preview file sizes via web application policies
  • Lower cache expiry time for browser file handlers to reduce stale application state issues

File operations from SharePoint already carry overhead compared to direct file shares so reducing unnecessary browser visualization can help.

Security Considerations When Allowing In-Browser File Opening

When assessing security trade-offs of browser file handling, weigh the following risks:

  • Elevated browser exploits and attacks via uncommon media formats like Flash or video files
  • Potential browser crashes or instability from malformed or malicious files
  • Information disclosure if sensitive files are cached or stored locally by the browser
  • Overuse of browser resource limits leading to denial of service
  • Users trained to blindly click and enable all actions in browser warning dialogues

Where possible, rely on native browser capabilities to preview mundane document files like PDFs or text. More complex file type parsing may require isolating risk via dedicated browser sessions.

Optimizing the End User Experience with File Handling

Finally, maximize end user productivity by:

  • Choosing simple, clean file handler interfaces over complex web-based viewers
  • Optimizing handlers to move between pages quickly during long parsing operations
  • Supporting backwards navigation in file history via browser buttons
  • Matching file type icons and previews to user expectations for each file category
  • Gracefully catching and communicating browser crashes due to faulty files

Well implemented browser file handling allows users to safely inspect files directly within common business processes without disrupting workflows to launch external applications.

Leave a Reply

Your email address will not be published. Required fields are marked *