WorkletSharedStorage: remainingBudget() method

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

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

js
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 addModule() or if the calling site does not have the Shared Storage API included in a successful privacy sandbox enrollment process.

Examples

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

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

Specifications

This feature does not appear to be defined in any specification.

Browser compatibility

See also