Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 743595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:52:56+00:00 2026-05-14T08:52:56+00:00

My understanding is that mime types are set by the web server. Why do

  • 0

My understanding is that mime types are set by the web server. Why do we add the type="text/javascript or type="text/css" attribute? Isn’t this a useless and ignored attribute?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:52:57+00:00Added an answer on May 14, 2026 at 8:52 am

    Douglas Crockford says:

    type="text/javascript"

    This attribute is optional. Since
    Netscape 2, the default programming
    language in all browsers has been
    JavaScript. In XHTML, this attribute
    is required and unnecessary. In HTML,
    it is better to leave it out. The
    browser knows what to do.

    He also says:

    W3C did not adopt the language
    attribute, favoring instead a type
    attribute which takes a MIME type.
    Unfortunately, the MIME type was not
    standardized, so it is sometimes
    "text/javascript" or
    "application/ecmascript" or something
    else. Fortunately, all browsers will
    always choose JavaScript as the
    default programming language, so it is
    always best to simply write <script>.
    It is smallest, and it works on the
    most browsers.

    For entertainment purposes only, I tried out the following five scripts

      <script type="application/ecmascript">alert("1");</script>
      <script type="text/javascript">alert("2");</script>
      <script type="baloney">alert("3");</script>
      <script type="">alert("4");</script>
      <script >alert("5");</script>
    

    On Chrome, all but script 3 (type="baloney") worked. IE8 did not run script 1 (type="application/ecmascript") or script 3. Based on my non-extensive sample of two browsers, it looks like you can safely ignore the type attribute, but that it you use it you better use a legal (browser dependent) value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It was my understanding that <script type=text/javascript src=//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js></script> <script type=text/javascript> $(document).bind('mobileinit', function () {
It's my understanding that the CSS Flexible Box Layout module is being rewritten and
It's my understanding that SQL Server 2005 does some sort of result or index
My understanding is that both JAAS and SQL Server can be configured to use
It is my understanding that since type/class unification every value is of a type
It's my understanding that Google App Engine with Google Web Toolkit has a client
Understanding that if someone had JavaScript disabled the site would not work then is
After some research, It is my understanding that you can not call a web
It is my understanding that every type (other than some primitives like int and
It's my understanding that GHC gives each thread a stack. Why is this necessary?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.