大网数据广告活动
Web 标准与前端开发

NotRestoredReasonDetails: reason property

· 52CE 我爱测

The **`reason`** read-only property of the NotRestoredReasonDetails interface returns a string describing a reason that the page was blocked from using the back/forward cache (bfcache).

Performance API

The reason read-only property of the NotRestoredReasonDetails interface returns a string describing a reason that the page was blocked from using the back/forward cache (bfcache).

Value

A string.

There are many different reasons why blocking could occur, and browsers can choose to implement their own specific reasons for blocking, based on how they operate. Developers should avoid depending on specific wording for reasons and be prepared to handle new reasons being added and deleted.

The initial values listed in the specification are:

  • "fetch"
    • : While unloading, a fetch initiated by the current document (e.g., via Window/fetch) was canceled while ongoing. As a result, the page was not in a stable state that could be stored in the bfcache.
  • "lock"
    • : While unloading, held locks and lock requests were terminated, so the page was not in a stable state that could be stored in the bfcache.
  • "masked"
    • : The exact reason is hidden for privacy purposes. This value can mean one of the following:
      • The current document has children contained in a cross-origin iframe, and they prevented storage in the bfcache.
      • The current Document could not be stored in the bfcache for user agent-specific reasons.
  • "navigation-failure"
    • : The original navigation that created the current document errored, and storing the resulting error document in the bfcache was prevented.
  • "parser-aborted"
    • : The current document never finished its initial HTML parsing, and storing the unfinished document in the bfcache was prevented.
  • "websocket"
    • : While unloading, an open WebSocket connect was shut down, so the page was not in a stable state that could be stored in the bfcache.

Additional blocking reasons may be used by some browsers, for example:

  • "unload-listener"
    • : The page registers an unload handler, which prevents bfcache usage. This serves as a useful warning, as unload is deprecated. See usage notes for more information.
  • "response-cache-control-no-store"
    • : The page uses no-store as a Cache-Control header value.
  • "related-active-contents"
    • : The page was opened from another page that still has a reference to this page, for example using "duplicate tab" functionality.

Examples

See Monitoring bfcache blocking reasons for examples.

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。