-

B / w difference <script

What's the difference between:

  • <script language = "javascript" type = "text / javascript"> </ script>

  • <script type = "text / javascript"> </ script>

  • <script language = "javascript"> </ script>

+5
source share
3 answers

Number 2 is the best you can do now and in the foreseeable future.

First, the attribute is languagedeprecated in the HTML 4.01 specification and draft HTML 5 specification and omitted from XHTML 1.0 Strict , so options 1 and 3 are missing.

-, ? . HTML 4.01 XHTML 1.0 type, , HTML5 , - text/javascript. , HTML5 , type, , HTML , <script></script> ( , , - ).

-, type? , MIME application/javascript, 2006 , text/javascript. RFC:

/javascript text/ecmascript, "". , , . ,

  * application/javascript
  * application/ecmascript

, .

IE ( 8) script <script> type application/javascript, application/ecmascript, , text/javascript.

+6

, .:)

(. W3C XHTML 1.1) text/javascript (. MIME- ). mime - /javascript, .

+7
<script language="javascript" type="text/javascript"></script>

HTML 4.01 / XHTML 1.0 Transitional with deprecated language attribute

<script type="text/javascript"></script>

HTML 4.01 / XHTML 1.0 Strict (or Transitional without an obsolete language attribute)

<script language="javascript"></script>

HTML 3.2

+3
source

All Articles