You are here: Reference > JavaScript > client-side > HTML DOM > properties > publicId (doctype)

publicId property (doctype)

Browser support:
Returns the public identifier portion of the doctype element.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that represents the public identifier.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the publicId property:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
        <script type="text/javascript">
            function GetDocType () {
                if (document.doctype) {
                    var docTypeName =;
                    var pubIdStr = document.doctype.publicId;
                    var sysIdStr = document.doctype.systemId;

                    var message = "Document type: " + docTypeName;
                    message += "\nDOCTYPE publicId: " + pubIdStr;
                    message += "\nDOCTYPE systemId: " + sysIdStr;
                    alert (message);
                else {
                    alert ("Your browser does not support this example!");
        <button onclick="GetDocType ();">Get DOCTYPE properties!</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content