navigation-timing icon indicating copy to clipboard operation
navigation-timing copied to clipboard

Extend Navigation Timing API to include back/forward cache NotRestoredReasons

Open rubberyuzu opened this issue 3 years ago • 4 comments

In TPAC 2021, we had a positive feedback on reporting back/forward cache NotRestoredReasons extending Navigation Timing API. e.g. Exposing why a page is not restored from back/forward cache in Navigation Timing API. link to WG minutes

Here is the explainer: NotRestoredReason Explainer

Our proposal on how to propose NotRestoredReasons is below:

var perfEntries = performance.getEntriesByType("navigation");
for (var i=0; i < perfEntries.length; i++) {
	console.log("= Navigation entry[" + i + "]");
	var p = perfEntries[i];
	// p.notRestoredReason == [{URL:"a.com", Id: "x", blocked: True, reasons:["broadcast channel"], children:[]}]
}

Please let me know if you have any feedback on this. Thanks!

rubberyuzu avatar Mar 08 '22 08:03 rubberyuzu

/cc @nicjansma @cliffcrocker @danshappir @achristensen07 @sbougonSF @bdekoz @sefeng211 for opinions

yoavweiss avatar Mar 08 '22 08:03 yoavweiss

This looks great! It seems like it would be a relatively simple addition to our RUM library. The only feedback so far from SpeedCurvers is related to the explainer. While it's fantastic to see the definitions and the 'how to fix' section is refreshing, there is concern about how maintainable this will be. We'd love to see a machine readable source for such things in the future.

crockercliff avatar Mar 08 '22 23:03 crockercliff

Thanks for the comment! Do you think linking to the web.dev article will help? We have detailed examples of how to fix some of the blocking reasons, though not covering all: article link

Please let me know what kind of format would be helpful. Thanks!

rubberyuzu avatar Mar 09 '22 08:03 rubberyuzu

I think this will be a great thing for RUM providers to report on. We would integrate this into boomerang.js once available!

nicjansma avatar May 31 '22 00:05 nicjansma