views:

26

answers:

1

When I add JavaScript files to web pages, I have always done for example like this:

<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript">
    // Custom script
</script>

But today I discovered in the response headers that JavaScript are actually served as application/javascript. Why is that? Is both correct? Or should I change one to the other? What's going on here?

+1  A: 

I think that this one explains it good: http://annevankesteren.nl/2006/05/javascript-mime-type

Tomasz Kowalczyk
Well, it explained that application/javascript was the one I should use. But not which one I *should* use... Also its from 2006. So is it still the case that I should use text/javascript because of browsers, or?
Svish
@Svish: At least IE 7 (and 8?) does have problems with `script` elements with MIME-type set to `application/javascript`, and as there are still plenty IE users out there…
Marcel Korpel