You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently developers can tell whether BFCache is being used or not but they cannot tell what reasons are blocking it from being used and what actions to take to improve their hit-rate. DevTools provide the testing feature to tell developers what reasons are blocking, but that is only for lab testing and not for gathering the data from the wild.
One way to solve this issue would be to provide an API to report the reasons why the page was not restored from bfcache if not.
One idea is to extend PerformanceNavigation API to include this information as below:
window.addEventListener("pageshow", (event) => {
if (!event.persisted) {
const navEntries = performance.getEntriesByType("navigation");
for (var i=0; i < navEntries.length; i++) {
console.log("= Navigation entry[" + i + "]");
var p = navEntries[i];
// p.notRestoredReasons == [{url:"a.com", id: "x", blocked: true, reasons:["Broadcast channel"], children:[]}]
}
}
});
It will have notRestoredReasons field that will contain the reasons in the frame tree structure.
Note that this would risk exposing cross-site information, so we should avoid reporting reasons from the cross-origin subframes.
We would like to have notRestoredReasons for our RUM measurements in Akamai mPulse.
We are starting to track BFCache-based navigations, and with that our RUM customers will become more interested in why specific navs were not BFCache-eligable. Gathering this information will be a huge help in pointing out the culprits in aggregate.
Introduction
Currently developers can tell whether BFCache is being used or not but they cannot tell what reasons are blocking it from being used and what actions to take to improve their hit-rate. DevTools provide the testing feature to tell developers what reasons are blocking, but that is only for lab testing and not for gathering the data from the wild.
One way to solve this issue would be to provide an API to report the reasons why the page was not restored from bfcache if not.
One idea is to extend PerformanceNavigation API to include this information as below:
It will have notRestoredReasons field that will contain the reasons in the frame tree structure.
Note that this would risk exposing cross-site information, so we should avoid reporting reasons from the cross-origin subframes.
Read the complete Explainer.
Feedback
I welcome feedback in this thread, but encourage you to file bugs against the Explainer.
The text was updated successfully, but these errors were encountered: