ChemPal Documentation - v1.18.0
    Preparing search index...

    Function hasHostPermissions

    • Whether the extension may send requests to a set of hosts.

      Parameters

      • origins: string[]

        Origin patterns, e.g. a supplier's requiredHosts

      Returns Promise<boolean>

      True when all of them are granted, or there are none

      When the browser rejects a pattern

      await hasHostPermissions(['https://www.example.com/*']); // false
      
      export async function hasHostPermissions(origins: string[]): Promise<boolean> {
      return origins.length === 0 || chrome.permissions.contains({ origins });
      }