You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Sjur Moshagen <sj...@mac.com> on 2013/01/24 22:01:00 UTC

Javascript mime type

Hello,

In the file '$FORREST_HOME/main/webapp/resources.xmap' there's the following match:

      <map:match pattern="**skin/**.js">
        <map:read src="{lm:skin.js.{2}}" mime-type="application/x-javascript" />
      </map:match>

x-javascript looks kind of strange and old. This is what wikipedia has to say about javascript mime type (http://en.wikipedia.org/wiki/Internet_media_type):

«• application/javascript: ECMAScript/JavaScript; Defined in RFC 4329 (equivalent to application/ecmascript but with looser processing rules) It is not accepted in IE 8 or earlier - text/javascript is accepted but it is defined as obsolete in RFC 4329. The "type" attribute of the <script> tag inHTML5 is optional. In practice, ***omitting the media type of JavaScript programs is the most interoperable solution,*** since all browsers have always assumed the correct default even before HTML5.»

(my emphasis)

If there are no objections, I will just remove the mime type from that (and similar) match(es).

Sjur


Re: Javascript mime type

Posted by Sjur Moshagen <sj...@mac.com>.
Den 24. jan 2013 kl. 22:33 skrev Tim Williams:

> On Thu, Jan 24, 2013 at 4:32 PM, Tim Williams <wi...@gmail.com> wrote:
>> On Thu, Jan 24, 2013 at 4:25 PM, Sjur Moshagen <sj...@mac.com> wrote:
>>> According to this page: http://stackoverflow.com/questions/4101394/javascript-mime-type
>>> and many others on the net, application/javascript is the correct answer, but not accepted by MS IE ≤ 8. Which leaves us with text/javascript. But several places (including the above) argues that leaving it empty is fine, and the most compatible. I have no strong opinions, though, just that the present mime type definitely is wrong :)
>> 
>> I'd go with text/javascript - it's a reasonable default.

Agrre, I'll commit.

>> It's worth
>> noting that we serve it as 'application/javascript' because that's the
>> default mime-type mapping for httpd[1].
> 
> Ooops.. dangling pronoun:( "we" == forrest.apache.org :)

:)

Sjur


Re: Javascript mime type

Posted by Tim Williams <wi...@gmail.com>.
On Thu, Jan 24, 2013 at 4:32 PM, Tim Williams <wi...@gmail.com> wrote:
> On Thu, Jan 24, 2013 at 4:25 PM, Sjur Moshagen <sj...@mac.com> wrote:
>> According to this page: http://stackoverflow.com/questions/4101394/javascript-mime-type
>> and many others on the net, application/javascript is the correct answer, but not accepted by MS IE ≤ 8. Which leaves us with text/javascript. But several places (including the above) argues that leaving it empty is fine, and the most compatible. I have no strong opinions, though, just that the present mime type definitely is wrong :)
>
> I'd go with text/javascript - it's a reasonable default.  It's worth
> noting that we serve it as 'application/javascript' because that's the
> default mime-type mapping for httpd[1].

Ooops.. dangling pronoun:( "we" == forrest.apache.org :)

--tim

Re: Javascript mime type

Posted by Tim Williams <wi...@gmail.com>.
On Thu, Jan 24, 2013 at 4:25 PM, Sjur Moshagen <sj...@mac.com> wrote:
> According to this page: http://stackoverflow.com/questions/4101394/javascript-mime-type
> and many others on the net, application/javascript is the correct answer, but not accepted by MS IE ≤ 8. Which leaves us with text/javascript. But several places (including the above) argues that leaving it empty is fine, and the most compatible. I have no strong opinions, though, just that the present mime type definitely is wrong :)

I'd go with text/javascript - it's a reasonable default.  It's worth
noting that we serve it as 'application/javascript' because that's the
default mime-type mapping for httpd[1].

--tim

[1] - http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

Re: Javascript mime type

Posted by Sjur Moshagen <sj...@mac.com>.
According to this page: http://stackoverflow.com/questions/4101394/javascript-mime-type
and many others on the net, application/javascript is the correct answer, but not accepted by MS IE ≤ 8. Which leaves us with text/javascript. But several places (including the above) argues that leaving it empty is fine, and the most compatible. I have no strong opinions, though, just that the present mime type definitely is wrong :)

Sjur

Den 24. jan 2013 kl. 22:12 skrev Tim Williams:

> I'd say text/javascript or application/javascript is the right answer.
> Omitting it feels pretty wrong though.
> 
> --tim
> 
> On Thu, Jan 24, 2013 at 4:01 PM, Sjur Moshagen <sj...@mac.com> wrote:
>> Hello,
>> 
>> In the file '$FORREST_HOME/main/webapp/resources.xmap' there's the following match:
>> 
>>      <map:match pattern="**skin/**.js">
>>        <map:read src="{lm:skin.js.{2}}" mime-type="application/x-javascript" />
>>      </map:match>
>> 
>> x-javascript looks kind of strange and old. This is what wikipedia has to say about javascript mime type (http://en.wikipedia.org/wiki/Internet_media_type):
>> 
>> «• application/javascript: ECMAScript/JavaScript; Defined in RFC 4329 (equivalent to application/ecmascript but with looser processing rules) It is not accepted in IE 8 or earlier - text/javascript is accepted but it is defined as obsolete in RFC 4329. The "type" attribute of the <script> tag inHTML5 is optional. In practice, ***omitting the media type of JavaScript programs is the most interoperable solution,*** since all browsers have always assumed the correct default even before HTML5.»
>> 
>> (my emphasis)
>> 
>> If there are no objections, I will just remove the mime type from that (and similar) match(es).
>> 
>> Sjur
>> 


Re: Javascript mime type

Posted by Tim Williams <wi...@gmail.com>.
I'd say text/javascript or application/javascript is the right answer.
Omitting it feels pretty wrong though.

--tim

On Thu, Jan 24, 2013 at 4:01 PM, Sjur Moshagen <sj...@mac.com> wrote:
> Hello,
>
> In the file '$FORREST_HOME/main/webapp/resources.xmap' there's the following match:
>
>       <map:match pattern="**skin/**.js">
>         <map:read src="{lm:skin.js.{2}}" mime-type="application/x-javascript" />
>       </map:match>
>
> x-javascript looks kind of strange and old. This is what wikipedia has to say about javascript mime type (http://en.wikipedia.org/wiki/Internet_media_type):
>
> «• application/javascript: ECMAScript/JavaScript; Defined in RFC 4329 (equivalent to application/ecmascript but with looser processing rules) It is not accepted in IE 8 or earlier - text/javascript is accepted but it is defined as obsolete in RFC 4329. The "type" attribute of the <script> tag inHTML5 is optional. In practice, ***omitting the media type of JavaScript programs is the most interoperable solution,*** since all browsers have always assumed the correct default even before HTML5.»
>
> (my emphasis)
>
> If there are no objections, I will just remove the mime type from that (and similar) match(es).
>
> Sjur
>