Document:characterSet 属性
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Document.characterSet
只读属性返回当前渲染文档字符编码。
备注: “字符集”和“字符编码”是相关的,但又有所不同。尽管这个属性的名称如此,但它返回的是编码。
值
一个字符串。
示例
html
<button onclick="console.log(document.characterSet);">输出字符编码</button>
<!-- 在开发控制台中显示文档字符编码,例如“ISO-8859-1”或“UTF-8” -->
规范
Specification |
---|
DOM # ref-for-dom-document-characterset① |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
characterSet |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Uses a non-standard name.
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.