[whatwg] Question about document.referrer (and document.URL, document.location.href) when IDN domains are in use

Boris Zbarsky bzbarsky at MIT.EDU
Wed Mar 20 19:46:15 PDT 2013

The spec for document.referrer says:

   The referrer attribute must return the document's referrer.

The "document's referrer" is not really defined anywhere in a useful way 
that I can find.

This then follows with a non-normative note:

    Note: In the case of HTTP, the referrer IDL attribute will match the
    Referer (sic) header that was sent when fetching the current page.

In cases when the hostname is non-ASCII, the Referer header will have it 
encoded in punycode.  The question is what should happen for 
document.referrer.  Right now, I see the following behavior:

1)  Gecko shows exactly the string we put on the wire in 
document.referrer (punycode and all).  document.URL and 
document.location.href show the non-ASCII chars in some cases.

2)  WebKit (or at least Chrome) seems to return punycode for all three 
of these.

3)  Opera seems to return non-ASCII chars for all three of these, at 
least in some cases.

No idea what IE does.

The question is whether it's more important for document.referrer to 
match the HTTP header (so the note will actually be true) or 
location.href and .URL...  Well, and the other question is what .URL and 
location.href should return, since clearly we don't exactly have interop 


More information about the whatwg mailing list