WICG / bfcache-not-restored-reason

Other
18 stars 5 forks source link

API detection #6

Open fergald opened 1 year ago

fergald commented 1 year ago

How can a page tell that the API exists in the browser but that the current page was not eligible for BFCache?

E.g.

  1. go to a page that will not be cached
  2. click on a link
  3. go back
  4. 4 duplicate the tab

performance.getEntriesByType('navigation')[0].type will be "back_forward"

performance.getEntriesByType('navigation')[0].notRestoredReasons will be undefined.

It's impossible to tell if the API is not implemented or it's missing because BFCache is impossible for a duplicated tab.

Perhaps the field should always be present but null when BFCache was impossible. We need to be careful about "not possible for that page at that time" vs "impossible for that navigation".