Skip to content

Proposal: Add optimization to ignore "duplicate" navigations #11743

@rakina

Description

@rakina

What problem are you trying to solve?

We observe users sometimes navigate to the same URL in quick succession, likely by accident. Because new navigations take precedent over an older one, this means it will waste the earlier navigation that's already in progress, potentially wasting a response that is already in flight for the navigation and causing the user to wait longer (from the time the first navigation kicks off).

What solutions exist today?

Maybe sites can check for e.g. double clicks with a click handler, but it won't help when other sites are linking to that site, and also other methods (e.g. clicking reload button)

How would you solve it?

Ignore the duplicate navigation and let the first navigation continue. Add a carveout in navigate that checks if a navigation can be considered a duplicate of an ongoing navigation in the navigable, and if so, just return early. Criteria for "duplicate" includes (ideas welcome):

  • The navigations start time difference is under a certain threshold (e.g. 3 seconds)
  • The navigations are both GET, no form data
  • The URL, initiator origin, referrer policy, headers (including cookies), userInvolvement, historyHandling of the navigations are the same

The ignoring will be mostly silent, but can be observable in e.g. the NavigationTiming API showing the navigation start time of the first navigation instead of the second navigation. If navigate() API is used, the ignored duplicate navigation will cause the Promise to reject. We probably want to also trigger WebDriver BiDi navigation failed so that automations won't get confused that a navigation just gets silently dropped.

Any suggestions of other things to change / be careful about is very welcome.

Anything else?

Chromium has been experimenting with this optimization with a partner and saw significant improvements in latency and also capacity (since we won't need to serve the same resource twice for a duplicated navigation). We want to standardize this behavior.

cc @fergald @llannasatoll @noamr @domfarolino

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions