Other Document Features
This chapter began with the assertion that it is one of the most important in the book. It is also, by necessity, one of the longest. This final section rounds out the chapter by covering a number of miscellaneous features of the Document object.
Document Properties
This chapter has already introduced Document properties such
as body, document
Element , and forms that refer to special elements of
the document. Documents also define a few other properties of
interest:
cookieA special property that allows JavaScript programs to read and write HTTP cookies. This property is covered in Chapter 20.
domainA property that allows mutually trusted web servers within the same Internet domain to collaboratively relax same-origin policy security restrictions on interactions between their web pages (see Relaxing the same-origin policy).
lastModifiedA string that contains the modification date of the document.
locationThis property refers to the same Location object as the
locationproperty of the Window object.referrerThe URL of the document containing the link, if any, that brought the browser to the current document. This property has the same content as the HTTP
Refererheader, but it is spelled with a double r.titleThe text between the
<title>and</title>tags for this document.URLThe URL of the document as a read-only String rather than as a Location object. The value of this property is the same as the initial value of
location.href, but it is not dynamic like the Location ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access