John Mellor
John Mellor

Reputation: 2503

Mozilla Firefox prefetching rel="next"

Firefox appears to prefetch anything that is set in a meta tag like so:

<link rel="next" href="http://domain.com/page/2">

More can be read about this here: http://developer.mozilla.org/en-US/docs/Link_prefetching_FAQ

Now on my site, when there are multiple pages for things like comments i've been using rel="next" and rel="previous", as I thought this was good mark up and may be used to help certain readers or search engine bots.

However i've also been trying to track what the last comment a user read was, but this hasn't been working (one of those stupid times when you spent hours on something simple).

Basically, when a user reads page 2 of 3 for instance, I update the database to say they've read page 2, but not page 3. However because page 3 gets prefetched, the code for that page runs and an SQL update fires for that page as well even though the user has never actually read page 3.

So really I have a few questiosn:

Upvotes: 5

Views: 2383

Answers (1)

Boris Zbarsky
Boris Zbarsky

Reputation: 35064

Answers to your question, in order:

  1. Sort of. You can throw a ?something on the ends of your URIs to make them not prefetchable, I think.
  2. Almost certainly. Chrome does various prefetching stuff too, and the ?something trick may not work there.
  3. Yes. See https://developer.mozilla.org/en-US/docs/Link_prefetching_FAQ#As_a_server_admin.2C_can_I_distinguish_prefetch_requests_from_normal_requests.3F in the FAQ you linked to.

Upvotes: 3

Related Questions