Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding file://. permission to chrome extension

How can I enable permissions for file:/// using chrome extensions. In my manifest.json I have tried:

"permissions": [
  "file:///*"
]

and

"permissions": [
  "file://*"
]

as well as

"permissions": [
  "*:///C"
]

None of these work.

like image 560
Morne Avatar asked Oct 21 '13 11:10

Morne


People also ask

How do I change the permissions of a Chrome extension?

How to Change an Chrome Extension’s Permissions. To control an extension’s access to your data, right-click the extension’s icon on your toolbar and point to “This can read and change site data.” Choose your preferred option: When you click the extension: The extension can’t see any of your data until you click it.

What are Chrome app permissions?

Chrome app and extension permissions For administrators who manage Chrome browser or Chrome OS devices for a business or school. As a Chrome Enterprise admin, you can control whether your Chrome users can install apps or extensions based on the information an app can access—also known as permissions.

How do I get chrome to grant optional permissions?

Use the chrome.permissions API to request declared optional permissions at run time rather than install time, so users understand why the permissions are needed and grant only those that are necessary. An extension can declare both required and optional permissions.

Do Chrome Extensions take over your browser?

You don’t have to let your Chrome extensions take over your browser. While it’s unfortunate that Chrome extensions demand so much control over reading and changing site data by default, you can at least change the permissions for ones that are noticeably problematic in these two ways.


1 Answers

"permissions": [
    "file://*/*"
]

Unless the extension is loaded from your local disk, file access will be disabled by default. The user has to manually approve this permission by visiting chrome://extensions/ and put a tick at the "Allow access to file URLs" checkbox.

In your code, you can see whether file access is allowed using chrome.extension.isAllowedFileSchemeAccess.

For a user-friendly way of requesting this access, see this answer.

like image 100
Rob W Avatar answered Oct 17 '22 04:10

Rob W