HTML DOM Document doctype
Example
Get the doctype name of an HTML document:
const doctypeObj = document.doctype.name;
Try it Yourself »
Description
The doctype
property returns a document's doctype (as a DocumentType object).
The doctype
property returns null
if the document has no doctype.
The doctype
property is read-only.
The doctype.name
property returns the name of the doctype.
See Also:
Syntax
document.doctype
Return Value
Type | Description |
Object | A DocumentType object. |
Browser Support
document.doctype
is a DOM Level 1 (1998) feature.
It is fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 9-11 |
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.