Type= "Application/javascript" HTML script tag type has the following values, what is the meaning of the respective, under what circumstances to use?
- Type= "Text/javascript"
- Type= "Application/javascript"
- Type= "Application/x-javascript"
What's the difference between these 3?
The traditional MIME type forJavaScript programs is
"Text/javascript".anothertype that have been used is"Application/x-javascript"( the"x"prefix indicates that it 's anExperimental,nonstandard type).RFC4329Standardized the"Text/javascript"type because it is in common use.however,becauseJavaScriptprograms is not really text documents,It marks ThistypeAs obsolete and recommends"Application/javascript"(without the"x") instead. at the time of ThisWriting,"Application/javascript" is notWell supported,however. thatmight is the reason why"Application/x-javascript"is used by a lot of webpages.
The general meaning is: The MIME type of the traditional JavaScript program is "Text/javascript", others use "Application/x-javascript" (The x prefix indicates that this is experimental, not the standard type), RFC4329 Specifies the "text/javascript" type , as it is commonly used. However, the JavaScript program is not a real text file, which means that this type has already meant obsolete, and it is recommended to use "Application/javascript" (remove the x prefix). However, when writing a program, "Application/javascript" is not very well supported. This is why "application/x-javascript" is not used in many Web pages.
您是否很疑惑为什么我们没有在<script>标签中使用 type="text/javascript"?
In HTML5, you don't have to do that. JavaScript is the default scripting language in HTML5 and all modern browsers!
Type= "Application/javascript"