Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Javascript 'type'



9:12 pm on Dec 18, 2001 (gmt 0)

10+ Year Member

Netscape Navigator requires that external scripts be served with a Content-Type of application/x-javascript

QUOTE SOURCE [htmlhelp.com]

I have always used type='text/javascript'. I know most browsers ignore the type atribute and take the 'language' attribute.

most browsers only support the deprecated LANGUAGE

The script I am using is external. I have tested in NS 4 + 6, Opera 5 + 6, IE 4.01+ all without the type attribute and it runs fine.

My Q is should I even worry about using application/x-javascript as a type??


9:38 pm on Dec 18, 2001 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

The quote you've posted doesn't refer to the HTML code but to the SERVER configuration. External .js files should be served as application/x-javascript, and most commercial hosts are so configured.

The HTML code to call an external js file, on the other hand, is best written by including both the deprecated language attribute and the current type attribute:
<script type="text/javascript" language="JavaScript url="code.js"></script>


10:13 pm on Dec 18, 2001 (gmt 0)

10+ Year Member

Your right...

I should have not 'scanned' so quick and seen the "be served with" snip...



Featured Threads

Hot Threads This Week

Hot Threads This Month