LoginSignup
0
1

More than 5 years have passed since last update.

javascriptからDOCTYPEを取得する

Last updated at Posted at 2015-06-26

もしかしたらDOCTYPEを見てJavaScriptの挙動を変えたい時があるかもしれないのでメモ。

次の3つから情報が得られる。.internalSubsetってのもあるらしいけれど、nullしか確認できてないので無視。

  • document.doctype.name
  • document.doctype.publicId
  • document.doctype.systemID

このうち、.namehtmlなので、それ以外を見る。

<!DOCTYPE html>

  • "html"
  • ""
  • ""

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  • "html"
  • "-//W3C//DTD HTML 4.01 Transitional//EN"
  • "http://www.w3.org/TR/html4/loose.dtd"
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1