Home > Web Front-end > JS Tutorial > body text

What is the use of text/javascript?

醉折花枝作酒筹
Release: 2021-06-15 14:04:53
Original
4636 people have browsed it

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.

What is the use of text/javascript?

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 <script> and </script> 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

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!