When in conflict between the document and the http header I always
choose the http header contents.  The DOM is an artifact of the
document, which itself is capable of being cached.  HTTP headers are
not ever cached, at least to my knowledge.  In the case of your
example if document.referrer is reporting a URI but the HTTP referrer
header is empty then it is possible the page is cached and the cache
preserved the document.referrer value even in the absence of such a
value from the HTTP header.

The prior point goes to accuracy.  Another, perhaps more important
point, is the issue of precedence when there is conflict between a
document and a HTTP header.  Consider a document that contains a HTTP
Accept header with a value of text/html and a HTTP Accept-Charset
header with the value ISO-8859-1 but the document contains the
following:

<meta http-equiv="Content-Type" content="application/xhtml
+xml;charset=UTF-8"/>

The meta tag is irrelevant because the document is already sent and
received in accordance with the supplied HTTP headers.  I would say
this same point applies roughly equally to document.referrer in that
what is reported by the HTTP header probably takes precedence over
what is reported by the DOM, in case this is about automated
analysis.  If you are unhappy with that is reported by the HTTP header
you can always get more granular information by crawling the nesting
of headers, of which next would be the TCP header containing the
negotiated IP traffic on the server.  If that is still good enough you
can always attempt to make sense of the corresponding ARP packet and
so forth.

Austin Cheney, CISSP
http://prettydiff.com/

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to