publicId (W3C DOM Core property)
| Version | Depr. | Static | Read-only |
|---|---|---|---|
| DOM2 | No | No | Yes |
| IE5.5+ | FF1.5+ | SA3+ | OP9+ |
|---|---|---|---|
| Partial | Full | Full | Full |
Example
var pubid = document.doctype.publicId;
The
example above saves a reference to the publicId
of the doctype. So if we were on a page with an XHTML 1.0 Strict doctype,
the pubid variable would have the value
-//W3C//DTD XHTML 1.0 Strict//EN.
Description
The public identifier of an
Entity or Notation, and in
DOM 2 of a DocumentType; or null
if no public identifier is specified.
This property is readonly.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 1.5 | 2.0 | 3.0 | 1.3 | 2.0 | 3.0 | 9.0 | 9.5 |
| Partial | Partial | Partial | Full | Full | Full | None | None | Full | Full | Full |
Only
Opera, Firefox and
Safari 3 are able to retrieve the
publicId of a DocumentType. In Internet Explorer in
XML the property is undefined; in Safari 1.3
and 2 in XHTML mode or XML1 it's
null; otherwise the doctype property itself is
null.
Only Opera in XHTML mode or
XML2 and Internet
Explorer in XML are able to retrieve the
publicId of an Entity or
Notation, because those are the only environments
in which the root objects themselves are exposed (see Entity and Notation for details).
User-contributed notes
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.