collective/collective.documentviewer — pull request #48 by sbworth (2014-12-16 16:51:46+00:00)
Title: Set javascript Content-Type for getTranslatedJSLabels return string

Javascript translation strings are defined in method getTranslatedJSLabels and returned as a string. The Content-Type header must be set to application/x-javascript or it defaults to text/plain, and the javascript resource is -- correctly -- rejected by modern security conscious browsers.

Encountered with Plone 4.3 and recent Chrome browser (Version 39.0.2171.95, 64-bit).

Not 100% sure if I should be setting charset="utf-8" but a discussion between David Glick and Martin Aspeli on Stack Overflow seemed to suggest that this is the most robust approach. (See http://plone.293351.n2.nabble.com/Setting-a-mime-type-on-a-Zope-3-browser-view-td4442770.html)