About
Every XML doc and HTML document (Web page) in an HTML UA is represented by a Document object.
A document in the context of a browser is generally a HTML document (Web Page).
The Document interface is the entry point to the whole DOM tree.
In a browser, it represents the whole web page.
A Document is created (the creation of the DOM):
- automatically in the browser for Javascript with HTML page. See Browser - Document variable (DOM) - Javascript
- by a script using the createDocument() or createHTMLDocument() DOM APIs.
Property
Address
The document's address is an absolute URL that is initially set when the Document is created but that can change during the lifetime of the Document, for example when the user navigates to a fragment identifier on the page or when the pushState() method is called with a new URL.
Referrer
The document.referrer returns the referer (The address of the Document (an absolute URL) from which the user navigated) If it is not explicitly set, then its value is the empty string.
There is no path, only the apex domain.
cookie
State
Type
- HTML,
- XML,
- SVG,
- …
With the Javascript document variable
type = document.contentType;
console.log("The document type is ("+type+")");
Flag
Reload
Each Document object has a reload override flag that is originally unset. The flag is set by the document.open() and document.write() methods in certain situations.