05 Jun 2026

feedDrupal.org aggregator

Dries Buytaert: Speculation Rules changed my mind about prefetching

For years, prefetching made me uneasy. It can make websites feel faster, but it also asks visitors to spend bandwidth, CPU, memory, and battery on pages they may never open. That always felt a little wasteful, and maybe even a little disrespectful.

A couple months ago, while updating my HTTP header analyzer, I added support for the Speculation-Rules HTTP header. Learning about the Speculation Rules API inspired me to try it on my own blog.

The idea is simple: a page can give the browser a small JSON rule set that says which links are safe to prefetch, and when. Those rules can live directly in the HTML using <script type="speculationrules">, or in an external file referenced by the Speculation-Rules HTTP header.

For my blog, I added the rules directly to the HTML of every anonymous page request:

<script type="speculationrules">
{
  "prefetch": [{
    "where": {
      "and": [
        { "href_matches": "/*" },
        { "not": { "href_matches": "/search*" } }
      ]
    },
    "eagerness": "conservative"
  }]
}
</script>

The rule tells browsers that any same-origin link is safe to prefetch, except for paths under /search*.

The eagerness: conservative setting fires the prefetch on pointerdown or touchstart, meaning the browser only starts prefetching once the user begins to click or tap a link. There are more aggressive options, such as prefetching when a link becomes visible or when a user hovers over it.

Some of you might point out that browsers have supported prefetching for years through the older <link rel="prefetch"> tag. That is true, but I've never loved it.

Traditional prefetching is great when the next page is highly predictable, like the next step in a checkout flow or setup wizard.

On many websites, including my blog, it's anyone's guess what a visitor will click next. Sometimes you can make a smarter guess, but it is still a guess.

And when you guess wrong, visitors spend bandwidth, battery, and compute on pages they never visit. Multiply that across millions of sites and visitors, and those speculative requests add up.

So why implement Speculation Rules? With eagerness: conservative, the browser waits until the user has already started an action. At that point, the navigation is no longer a vague prediction. It is very likely to happen.

Speculation Rules also respect Battery Saver and Data Saver modes. If a device is low on battery, memory constrained, or trying to conserve data, the prefetching is skipped.

So is prefetching still worth it when the user has already started to click? I think so. With eagerness: conservative, the browser only gets a small head start but something is better than nothing.

Browsers already do some speculative loading on their own without Speculation Rules, but only for high-confidence destinations, like the address bar suggestion you are typing toward.

But they will not prefetch arbitrary links on a page, and for good reason. Prefetching /logout, for example, would sign the visitor out, even if they change their mind and never complete the click or hit Enter.

That is why Speculation Rules can be useful. You can tell the browser which paths are safe and which to leave alone.

In short, Speculation Rules changed my mind because they make prefetching feel more responsible: don't prefetch too much, don't prefetch too early, and only give the browser a safe hint when the user's intent is clear.

05 Jun 2026 2:37pm GMT

The Drop Times: Niels de Feyter: Why Drupal 7 Upgrades Need More Than a Migration Plan

For organisations still running Drupal 7, the challenge is often less about whether to upgrade and more about how to modernise without disrupting critical business operations. Niels de Feyter, founder and lead developer of CodeLift, argues that successful upgrades depend on preserving a system's observable behaviour while modernising its underlying platform. In this interview with The Drop Times, he discusses verification, migration complexity, ageing infrastructure, AI-assisted development, and the risks organisations face as legacy systems grow older.

05 Jun 2026 2:03pm GMT

feedSymfony Blog

New in Symfony 8.1: Console Progress and Testing Improvements

The Console component has been a major focus of Symfony 8.1, and we've already covered a lot of new features in previous articles: improved console input, console argument resolvers, method-based commands, and HTTP-less Symfony applications. This article…

05 Jun 2026 10:50am GMT

feedDrupal.org aggregator

1xINTERNET blog: Meet Us at the AI Summit London: Bringing Open Source Governance to the AI Era

Explore the future of enterprise AI at The AI Summit London 2026. See how open-source architecture is becoming the foundation for secure, scalable, and future-ready enterprise AI.

05 Jun 2026 10:00am GMT

04 Jun 2026

feedSymfony Blog

New in Symfony 8.1: ObjectMapper Improvements

The ObjectMapper component was introduced in Symfony 7.3 to eliminate the repetitive boilerplate involved in copying data between objects, such as DTOs and entities. Symfony 8.1 builds on that foundation with several improvements that make mappings more expressive…

04 Jun 2026 12:52pm GMT

SymfonyOnline June 2026: Symfony 8: The Hexagonal Track

Upgrade your skills from home! SymfonyOnline June 2026 brings 13 high-level technical sessions online on June 11-12, 2026. 🎤 Speaker announcement! SymfonyOnline June 2026: We are super happy to have Core Team member Robin Chalas with his talk "Symfony…

04 Jun 2026 8:30am GMT

01 Apr 2004

feedPlanet PHP

ezSystems are classy folks

cover
Last week I helped the folks at ezSystems debug some APC problems they were having. The problems ended up being a 64bit architecture problem (they have uber-fast Opterons) and the bug is now fixed in 2.0.3.

Today I received Python & XML from them (off my Amazon wishlist). Thanks guys!

On a side note, my wishlist seems borked. The list I get when I search on my email address or name is not the same one I can edit when I log into the site.

01 Apr 2004 6:53pm GMT

PHP april fools...

1st of April 2004 get's to it's end and I guess it's time, to summarize the recent April fools a bit. Not that I think anyone in the world believes in them, but some were quite funny:

1. Changes to case sensitivity in PHP.
Alan Knowles announced that PHP will change to the studlyCase API and therefor will get everything broken by changing established functions.

2. IBM takes over Zend.
Myself hacked a little article about IBM taking over Zend to make PHP a compete of Java.

3. The first PHP virus has been seen.
Wasn't there one last year, too?

4. PHP has been overtaken by Micro$oft.
Mhhh... a little bit unreliable, if they had been taken over by IBM this morning... Maybe one should first look, what others wrote...

5. And finally, PHP4 and 5 showed their real faces...
Take a look at a phpinfo() output!

I guess I missed some, so feel free to comment on this entry, if you found another!

01 Apr 2004 5:49pm GMT

PHP Virus Attacking Web Hosts

Symantec have a report of the virus here. I've yet to see any of the PHP news sites picking up on it but, using a virtual host account, managed to deliberately expose some PHP scripts to it. From examining the infected scripts, what's disturbing is once infected, every tim...

01 Apr 2004 12:19pm GMT