extension.isAllowedFileSchemeAccess()

Returns true if the extension can access the "file://" scheme, false otherwise.

Access is determined by a user-controlled option in the extension's permissions: 'Allow access to File URLs' on Chrome and 'Access local files on your computer' on Firefox.

Note: In Firefox 152 and earlier, access to local files is covered by the "Access your data for all websites" host permission and this method always returns false.

Syntax

js
let isAllowed = browser.extension.isAllowedFileSchemeAccess()

Parameters

None.

Return value

A Promise fulfilled with a boolean: true if the extension is allowed access to "file://" URLs, false otherwise.

Examples

js
function logIsAllowed(answer) {
  console.log(`Is allowed: ${answer}`);
}

let isAllowed = browser.extension.isAllowedFileSchemeAccess();
isAllowed.then(logIsAllowed);

Browser compatibility

Note: This API is based on Chromium's chrome.extension API. This documentation is derived from extension.json in the Chromium code.