Home>Article>Web Front-end> What is the use of text/javascript?
In javascript, the function of text/javascript is to tell the browser to parse according to JavaScript. IE browser defaults to javascript, but other browsers may not, which can prevent the browser from using other parsing methods. and version compatibility issues.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
It makes no difference whether text/javascript is written or not. However, it is recommended to write
text/javascript to tell the browser to parse according to JavaScript
The default of IE browser is javascript, but other browsers may not
In order to prevent the browser from using other parsing and version compatibility issues, it is better to write it
Extension information:
The required type attribute specifies the MIME of the script type.
The type attribute identifies the content between the 3f1c4e4b6b16bbbd69b2ee476dc4f83a and 2cacc6d41bbb37262a98f745aa00fbf0 tags.
MIME types consist of two parts: media type and subtype. For JavaScript, the MIME type is "text/javascript".
Both the type and language attributes can be used to specify the type of script in the 3f1c4e4b6b16bbbd69b2ee476dc4f83a tag.
The language attribute has been criticized in the HTML and XHTML standards, which promote the use of the type attribute. Unfortunately, the values of these two properties are not the same.
If you are using JavaScript, you can use the following two attributes:
language = "JavaScript"
Or:
type = "text/javascript"
You may occasionally see the value of language as VBScript (for type is text/vbscript), indicating that the included script code is written in Microsoft's Visual Basic Script.
With JavaScript, you can also use the language value "JavaScript 1.1" to indicate that the included script statements can only be processed by Netscape 3.0 or later. Netscape 2.0 only supports JavaScript 1.0 and cannot handle scripts marked "JavaScript 1.1".
[Recommended learning:javascript advanced tutorial]
The above is the detailed content of What is the use of text/javascript?. For more information, please follow other related articles on the PHP Chinese website!