SYNCERのロゴ
アイキャッチ画像

Document.charset - 文字エンコーディング

charsetは、Documentのプロパティです。ドキュメントの文字エンコーディングを返します。このプロパティは歴史的な理由で残されています。代わりにcharacterSetを使って下さい。

このAPIは非推奨です。新しくコードに加えず、代わりの手段を探して下さい。

概要

名前
charset
所属
Document
IDL
readonly attribute DOMString charset; // historical alias of .characterSet
仕様書
https://dom.spec.whatwg.org/#dom-document-charset

説明

文字エンコーディングを返す。読み取り専用なので、値を代入して変更することはできない。

デモ

Document.charsetのデモです。

<!-- このコードは編集できます。 -->

<!DOCTYPE html>
<html>
<body>
<script>
var value = document.charset ;

console.log( value ) ;
document.body.appendChild( new Text( value ) ) ;
</script>
</body>
</html>

サポート状況

ChromeFirefoxSafariEdgeIEOperaiOS SafariAndroid
44+ 9+
  • Twitterでシェア
  • Facebookでシェア
  • Google+でシェア
  • はてなブックマークでシェア
  • pocketに保存
  • LINEでシェア
更新履歴
2017年10月5日 (木)
コンテンツを公開しました。