[whatwg] Feedback on Meta referrer

Adam Barth w3c at adambarth.com
Thu Jan 26 00:12:33 PST 2012

On Sun, Jan 1, 2012 at 10:55 PM, Simon Pieters <simonp at opera.com> wrote:
> On Sat, 31 Dec 2011 19:11:53 +0100, Adam Barth <w3c at adambarth.com> wrote:
>> The policy for a given network fetch is determined when the fetch is
>> made.  In this case, the request for a.css will include the Referer
>> header.  If you move the <meta> tag above the <link> tag, then the
>> request will not include the Referer header.
> What about:
>  <head>
>    <script src="foo.js"></script>
>    <meta name="referrer" content="never">
>    <link rel="stylesheet" href="a.css">
>  </head>
> ...and the browser speculatively fetches the stylesheet before the <meta>
> element is in the DOM?

The controlling policy is the one in effect when the fetch is made.
In this case, the user agent performs the fetch before processing the
<meta> element, so the fetch is made with a Referer header.

> Should the speculative parser have knowledge of <meta name=referrer>?

That's not what's currently specified.  Like many other browser
features, this feature lets web sites detect that the browser is
speculatively prefetching resources.  If that's a big issue, it's
something we can try to address.

On Mon, Jan 9, 2012 at 12:53 AM, Simon Pieters <simonp at opera.com> wrote:
> On Thu, 05 Jan 2012 18:37:05 +0100, Boris Zbarsky <bzbarsky at mit.edu> wrote:
>> I would say it should handle this just like it handles <base> tags,
>> whether that's through keeping track of it or through the speculation
>> failing.
> OK, so the speculative parser needs to scan for the feature. My thinking was
> that the speculative parser currently doesn't need to look at <meta>, but it
> does look at <base>, and usually there's zero or one <base> but can be lots
> of <meta>s, so it could be slightly cheaper to put this on <base> compared
> to <meta>. Maybe the difference is negligible, though.

I'm not sure all implementations have the speculative parser
understand <base>.  For example, WebKit's preload scanner does not
appear to understand the <base> element:


>>> Perhaps this should even be an attribute on <base> -- <base
>>> referrer="...">
>> Note that when you have multiple <base> tags only the _first_ takes
>> effect,
> Only for the same attribute -- if you have one <base href> and one <base
> target> they both get applied. (Which still isn't the proposed behavior for
> <meta referrer>, I know.)

Being able to change the referrer policy is valuable, e.g., for web
sites display a variety of content in a single document.  For example,
all of Twitter runs in a single document, but different referrer
policies might be appropriate for different "views" (for lack of a
better word) displayed by that document.


More information about the whatwg mailing list