Skip Navigation
+44 1273 906 908   hi@addedbytes.com @AddedBytes
Added Bytes

Everything tagged with "mozilla"

You can subscribe to this tag by rss or view all tags.

Mozilla and Google's prefetching functions are a nice addition to browser technology in many ways. They are not without flaws, however. The main two problems with the prefetching idea are that it messes with log files and it means every link on a page could potentially be followed despite the consequences (dangerous in a site administration context).

It appears from the FAQ that Google only intends their accelerator to prefetch specific pages, that have been specified with the <link> tag. However, many people are claiming that normal links have been prefetched.

To prevent prefetching of a page is simple: add the following PHP to the page you do not want prefetched:

if ((isset($_SERVER['HTTP_X_MOZ'])) && ($_SERVER['HTTP_X_MOZ'] == 'prefetch')) {
    // This is a prefetch request. Block it.
    header('HTTP/1.0 403 Forbidden');
    echo '403: Forbidden<br><br>Prefetching not allowed here.';
    die();
}

This will serve a "forbidden" header to the prefetcher. Normal browsing should be unaffected.

Hi! We are Added Bytes, a creative team of e-commerce experts from Brighton, UK specialising in Magento websites.
We are available for projects starting in September.
Check out our Services and Portfolio or Get in Touch!