0
Files
src/docs/experiments/not-restored-reasons.md
Yuzu Saijo 0a936704a1 [bfcache] Add a doc for NotRestoredReasonsAPI
This CL adds a document for NotRestoredReasons API, including how to
enable OT.

Change-Id: Ibcdb6d6a4ec4868538b1d039a3ddc2a0b79c96db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3990299
Reviewed-by: Fergal Daly <fergal@chromium.org>
Commit-Queue: Yuzu Saijo <yuzus@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1069519}
2022-11-10 01:57:30 +00:00

2.2 KiB
Raw Blame History

Back/forward cache NotRestoredReasons API

Contact: bfcache-dev@chromium.org

This document describes the status of the current implementation of the NotRestoredReasons API in Chrome, and how to enable it.

Starting from version 108, Chrome experimentally supports NotRestoredReasons API. This allows sites to access what reasons are preventing their pages from being restored from back/forward cache..

Note that this API is not available by default. Chrome plans to do an origin trial to evaluate its effectiveness and to allow site authors to give feedback.

Whats supported

A new field notRestoredReasons is added to performanceNavigationTiming API. This new field will report the reasons that prevented back/forward cache on the page in a frame tree structure.

Activation

The policy can be enabled in several ways.

Using the Chromium UI

Enable the flag chrome://flags/#enable-experimental-web-platform-features . You also have to enable back/forward cache flag via chrome://flags/#back-forward-cache .

Using Origin Trial

The Origin Trial feature is named NotRestoredReasons. Registration for the trial is here. See feature status to find out if the origin trial is currently running.

The origin trial tutorial describes how to participate.

Verifying the API is working

In devtools, run the following piece of javascript after navigating to a page, and clicking back/forward button.

performance.getEntriesByType('navigation')[0].notRestoredReasons;

If it gives you a value, it succeeds. If it gives undefined then the feature is not enabled.