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

WorkletSharedStorage: remainingBudget() method

· 52CE 我爱测

The **`remainingBudget()`** method of the WorkletSharedStorage interface returns the remaining navigation budget for the current origin.

Shared Storage API

The remainingBudget() method of the WorkletSharedStorage interface returns the remaining navigation budget for the current origin.

The navigation budget is the number of entropy bits permitted inside a fencedframe due to the WindowSharedStorage.selectURL() calls per origin every 24 hours. This is not the same as the number of navigations; rather, it is based on the number of potential navigations in each call. Each time a selectURL() navigation occurs, the corresponding origin's budget decreases by the logarithm (base 2) of the number of URL choices.

Navigation budget is a mechanism designed to limit the rate of leakage of cross-site data to the destination pages navigated to in fenced frames.

Syntax

remainingBudget()

Parameters

None.

Return value

A Promise that fulfills with a number representing the remaining navigation budget.

Exceptions

  • TypeError
    • : Thrown if the worklet module has not yet been added with Worklet.addModule or if the calling site does not have the Shared Storage API included in a successful privacy sandbox enrollment process.

Examples

// remainingBudget() available inside a shared storage worklet module

async function retrieveBudget() {
  const budget = await this.sharedStorage.remainingBudget();
  console.log(budget);
}

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

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

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