jquery - difference between type=textjavascript and language=javascript - Stack Overflow

Basically this is the question. Which is the difference between these two statements:language<script

Basically this is the question. Which is the difference between these two statements:

language

<script language="javascript" src="_js/calendar/calendar.js"></script>

text/javascript

<script type="text/javascript" src="_js/calendar/calendar.js"></script>

Basically this is the question. Which is the difference between these two statements:

language

<script language="javascript" src="_js/calendar/calendar.js"></script>

text/javascript

<script type="text/javascript" src="_js/calendar/calendar.js"></script>
Share Improve this question asked Sep 5, 2012 at 7:47 Daniel Ramirez-EscuderoDaniel Ramirez-Escudero 4,04713 gold badges46 silver badges81 bronze badges 2
  • nothing really. they both run & execute. – user1251600 Commented Oct 6, 2012 at 5:33
  • Just because they both currently run and execute doesn't mean they have no difference – Ben Taliadoros Commented Apr 25, 2013 at 9:03
Add a ment  | 

3 Answers 3

Reset to default 6

Per the HTML 4.01 Spec:

type: This attribute specifies the scripting language of the element's contents and overrides the default scripting language. The scripting language is specified as a content type (e.g., "text/javascript"). Authors must supply a value for this attribute. There is no default value for this attribute.

language: Deprecated. This attribute specifies the scripting language of the contents of this element. Its value is an identifier for the language, but since these identifiers are not standard, this attribute has been deprecated in favor of type.

Language is generally used to indicate the Javascript version that your script requires. Browsers that support the language attribute won't load or run the script if it doesn't support it. About the only use would be if you had critical Javascript functions where you needed workarounds for older browsers.

The language = JavaScript suggests that the language formatting and error-checking is to be based on JavaScript standards. The type = text/javascript only suggests that the inner contents' formatting will be text, in JavaScript form.

But language = JavaScript is deprecated anyway, so don't worry.

Taking a look at W3 language should have been deprecated or removed :

<!ELEMENT SCRIPT - - %Script;          -- script statements -->
<!ATTLIST SCRIPT
  charset     %Charset;      #IMPLIED  -- char encoding of linked resource --
  type        %ContentType;  #REQUIRED -- content type of script language --
  src         %URI;          #IMPLIED  -- URI for an external script --
  defer       (defer)        #IMPLIED  -- UA may defer execution of script --
  >

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742400344a4436788.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信