What is firefox prefetching?
In particular, Firefox will, at times, "prefetch" the contents of a web page which it thinks you might want to see soon. If a page is marked as being the "next" page in a series, Firefox, by default, will prefetch that page's contents. (And, yes, for those who have asked for "next" tags for the LWN Weekly Edition, it will happen when we get a chance). When the user hits the link for the next page, it will already be resident in the Firefox cache, and will display more quickly.
The interesting thing is that Firefox can be told explicitly to prefetch pages; all it takes is a tag like:
<link rel="prefetch" href="URL">
Google will, if it decides that you should be feeling lucky, add such a tag
to the first in a series of search results, causing that first result to be
prefetched. Among other things, this prefetch can cause cookies to be set
in the browser even though the person ostensibly in control of the browser
never decides to visit the site. An easy experiment will verify this
behavior: turn on cookie notifications, then search for a term with a
relatively obvious top result - Lauren used "soundbite." The result will
be a screen somewhat like that shown on the right: the soundbite.com web
server is attempting to set cookies, even though your editor never clicked on a link
which would lead to that site.
Prefetching in this way can lead to a number of undesirable consequences: unwanted cookies, bandwidth use, etc. More seriously, it could lead to accesses to truly unwanted sites: stumbling into non-work-safe sites is already too easy, without one's browser deciding to fetch additional pages from arbitrary servers with no user participation. Should an unpleasant Firefox security hole be discovered, prefetching could, for the right sort of vulnerability, be exploited to compromise systems. That would be an unwelcome sort of surprise.
Google's use of prefetching in this way is unfortunate; it seems certain to lead to trouble for somebody, somewhere down the line. The real problem, however, is with Firefox, which is shipped with prefetching turned on. There is no indication, anywhere in the preference screens, that an option controlling prefetching even exists. Anybody wanting to disable prefetching will have to edit their prefs.js file, or tweak the network.prefetch-next option on the about:config screen. Turning off prefetch in this way will slow down some page loads, but, for many users, the extra delay will be worth it.
[As a postscript, your editor can't help but poke at a bit of poor user
interface design in Firefox. An attempt to pull up a long page yielded this dialog, asking: "A script on this page is
causing mozilla to run slowly... Do you want to abort the script?" The two
buttons are marked "Cancel" and "OK". It is nice that Firefox does not
entirely lose control in such situations. But does "Cancel" kill the
script, or let it run?]
Posted Jun 16, 2005 1:13 UTC (Thu)
by flewellyn (subscriber, #5047)
[Link] (6 responses)
Posted Jun 16, 2005 6:28 UTC (Thu)
by beejaybee (guest, #1581)
[Link] (2 responses)
In this case on/off control is too coarse, I guess the best idea may be to whitelist sites which are allowed to push unrequested content, even if only as far as the browser cache.
Posted Jun 17, 2005 2:26 UTC (Fri)
by xoddam (subscriber, #2322)
[Link] (1 responses)
Posted Jun 20, 2005 12:18 UTC (Mon)
by gdt (subscriber, #6284)
[Link]
That's assuming the prefetch has to be perfect. Even fetching the redirect page will cut out one round-trip time (that's 0.2s for international users of US websites, sounds small but remember from User Interfaces 101 that a response time >0.3s is perceived as "slow"). With that in mind, prefetch using the current set of cookies and stop when it requires a cookie to be written. If the user selects the prefetched page then write that cookie and continue. That means that some pages are "prefetch unfriendly", but that's the case anyway (the discussion about multiple sets of cookies is really about how to work around that unfriendliness).
Posted Jun 16, 2005 7:39 UTC (Thu)
by andersg (guest, #25522)
[Link] (2 responses)
I really with prefetching could be limited to only prefetch on the same site.
Posted Jun 16, 2005 8:44 UTC (Thu)
by NAR (subscriber, #1313)
[Link] (1 responses)
The "about:config" interface is only a little bit more user friendly that editing the binary with vi - at least for those of us who have no idea what "ui.key.saveLink.shift" means.
Posted Jun 16, 2005 15:58 UTC (Thu)
by mmarsh (subscriber, #17029)
[Link]
Posted Jun 16, 2005 3:52 UTC (Thu)
by mattdm (subscriber, #18)
[Link]
Posted Jun 16, 2005 10:24 UTC (Thu)
by Dom2 (guest, #458)
[Link]
Personally, I feel that those kind of problems are down to poor application design. But that doesn't mean to say that there's not a lot of poorly designed stuff out there.
Thankfully, somebody came up with a good workaround.
-Dom
Posted Jun 17, 2005 5:02 UTC (Fri)
by grouch (guest, #27289)
[Link] (1 responses)
Posted Jun 17, 2005 9:27 UTC (Fri)
by gerv (guest, #3376)
[Link]
Posted Jun 17, 2005 15:27 UTC (Fri)
by KaiRo (subscriber, #1987)
[Link]
Posted Jun 23, 2005 6:04 UTC (Thu)
by roc (subscriber, #30627)
[Link]
The only issue is whether friendly sites are using it correctly. So the question is, is Google doing the right thing with its prefetch directives? Their FAQ indicates that they only issue a prefetch when their analysis shows that the vast majority of users go straight to that search result. Whatever bad thing happens when you load that site already happens to 99% of the users with that search term. Furthermore since Google already has some sort of porn detection, that can be applied as a filter too.
Anyway, whether or not Google is doing the right thing, it is not a Firefox issue. Apart from the fact that malicious sites can already get the same effects using hidden IFRAMEs, Firefox has had prefetching for *years* and no real problems have been detected.
I really really wish they had an "advanced features" tab in the preferences for Firefox, under which every behavior that was tweakable via prefs.js could be set. I dislike hidden features.What is firefox prefetching?
Me too. And when there are privacy / security implications (which there clearly are in this case) the default mode should be "safe" i.e. prefetch off.What is firefox prefetching?
> even if only as far as the browser cache. What is firefox prefetching?
That *sounds* like a neat situation -- record the http session and don't
"replay" it into the browser proper (setting cookies, etc.) until the
user has explicitly requested the page.
Unfortunately many websites don't just give you a page when you first
make your http request, but rather set some cookies in a 'redirect' or
'continue' response, and can give you all sorts of silly responses if you
don't reply with the cookie.
So at best, to prefetch a whole page without accepting cookies into the
cache, you'd have to do it in a sandbox which can handle its own cookies.
If you want to support scripts too (necessary for fetching images in many
cases) it becomes ludicrously complex.
I'd rather not prefetch at all.
No need for prefetch to be perfect
There is? It's called about:configWhat is firefox prefetching?
It's called about:config
What is firefox prefetching?
Not to mention options like accessibility.tabfocus, which is an integer that I currently have set to the highly obvious value of 7.What is firefox prefetching?
This is tough, because prefetching is really nice when it works for what it should. A simple solution would be to make prefetching work like the normal "secure" cookie setting: only allow prefetching of URLs from the same site. Still useful for a lot of cases, but no Google surprises.What is firefox prefetching?
Prefetching also came up a few weeks ago, in the context of the google web cache. See this blog entry on why it caused problems.
Prefetching considered harmful
Firefox yet again assumes it knows better than the user and gets it wrong. I am very glad that a group of developers decided to keep Mozilla going.What is firefox prefetching?
I believe Mozilla also does link prefetching by default. BICBW.What is firefox prefetching?
IIRC, the dialog you noted in the bottom paragrph has been reworded in the last months and should be more helpful with button choices in Deer Park (and current Mozilla/SeaMonkey nightlies).What is firefox prefetching?
A malicious site can already secretly load other sites on your behalf. It's as simple as creating a hidden IFRAME; <link rel="prefetch"> provides no new abilities here. So the use of prefetching by malicious sites is not interesting, and there is no point in Firefox trying to protect you from them.Prefetching considered harmless