application/x-javascript vs. text/javascript.

P

Peter Rilling

What is the difference between application/x-javascript and text/javascript.
While writing a web spider, I notice that different servers may send
different content code. Also on one particular site, the text within the
HTML for the <script> tag indicates "text/javascript" while the server
actually sends down content of type "application/x-javascript". Are there
other types that I should be aware of for identifying javascript files.
 
M

Martin Honnen

Peter said:
What is the difference between application/x-javascript and text/javascript.
While writing a web spider, I notice that different servers may send
different content code. Also on one particular site, the text within the
HTML for the <script> tag indicates "text/javascript" while the server
actually sends down content of type "application/x-javascript". Are there
other types that I should be aware of for identifying javascript files.

There is no registered MIME type for JavaScript, when Netscape 3 introduced
<script src="file.js" language="JavaScript"></script>
they suggested to use
application/x-javascript
as the Content-Type associated with .js files on the server.
Later the HTML 4 specification introduced
<script type="mime-type"
and suggested to use
<script type="text/javascript"
and that way you nowadays find most pages using that while servers
mostly still use application/x-javascript.
Browsers noadays should accept both types I think.
As for other types, with SVG (scalable vector graphics) you can also
find text/ecmascript, again nothing registered but somehow used as
ECMAScript is the standard for the core JavaScript language.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top