Instructions for using the charset attribute of the script tag_Basic knowledge
- WBOYOriginal
- 2016-05-16 18:14:401388browse
Definition and usage
The charset attribute specifies the character encoding used in external script files.
If the character encoding in the external file is different from the encoding in the main file, the charset attribute is used.
The default character encoding is ISO-8859-1.
src and charset attributes
For particularly long JavaScript programs or programs that are frequently used repeatedly, you may wish to store this code in a separate file. In this case, let the browser load that individual file via the src attribute. The value of
src is the URL of the file containing this JavaScript program. The MIME type of the saved file should be application/x-javascript, but if the file name has a .js suffix, it will be handled appropriately by a properly configured server.
For example, the following statement:
The above example tells support for the
tag that is also required.
The charset attribute is used in conjunction with the src attribute to tell the browser the character set used to encode this javascript program. Its value is the name of any ISO standard character set encoding.
Example
Defines the character encoding used in external script files:
To view all available character sets, please visit our <script> 的浏览器从服务器上下载名为 abc.js 的 JavaScript 程序。 <br><br>重要事项:请注意,尽管<script> 标签没有内容,结束的 </script>Character Set Reference Manual.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn