Skip to main content
InterviewHubPRO
Section Overview
Q20

Question 20 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

40%
Web Vitals & Performance (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

What is the Speculation Rules API and how does it enable 0ms navigations?

senior LevelCode ExampleRoutingSystem DesignHTTP & REST APIs

In Simple Words: The modern browser standard replacing legacy prerendering:

html
<script type="speculationrules">
{
  "prerender": [
    {
      "where": { "href_matches": "/products/*" },
      "eagerness": "moderate"
    }
  ]
}
</script>
  • When a user hovers over a link, the browser fully pre-renders the next page in an invisible background tab.
  • When the user actually clicks the link, the page activates instantly ($0\text{ms}$ load time, 100/100 Core Web Vitals score!).