Disabled Radio Button for Site Data Access in Chrome Extension

203 views
Skip to first unread message

真也福永

unread,
Oct 22, 2024, 11:08:46 AMOct 22
to Chromium Extensions
Hello,

In my Chrome extension, the "Read and change site data" option shows a disabled radio button for specific domains. I have added "optional_permissions" and "optional_host_permissions" in my manifest, but users cannot select specific domains or "all sites" when managing permissions.
2024-10-22_19h40_19.png

Could you help me understand why this radio button remains inactive and how I can ensure it becomes selectable?

[manifest.json]
{
  "manifest_version": 3,
  "name": "WEBふきだし",
  "version": "1.0.23",
  "icons": {
  },
  "action": {
    "default_icon": {
    },
    "default_popup": "index.html",
    "default_title": "WEBふきだし"
  },
  "permissions": [
    "activeTab"
  ],
  "optional_permissions": [
    "identity",
    "scripting",
    "contextMenus",
    "storage"
  ],
  "optional_host_permissions": [
    "*://*/*"
  ],
  "background": {
    "service_worker": "service-worker-loader.js",
    "type": "module"
  },
  "key": "*************************",
  "oauth2": {
    "client_id": "*******************************************",
    "scopes": [
      "https://www.googleapis.com/auth/userinfo.email"
    ]
  }
}

Thank you!


themirrazz

unread,
Nov 6, 2024, 4:15:21 AMNov 6
to Chromium Extensions, 真也福永
Hello, 真也福永さん

In order for the user to be able to select optional permissions, I believe it must not be marked as optional_host_permissions but simply as host_permissions. If you would like to use optional_host_permissions, you can leverage the Permissions API, which allows you to request additional permissions. Please note that the API can only request extra permissions if triggered by a user interaction (e.g., clicking a button).

Here’s a link to the full documentation for the Permissions API:
https://developer.chrome.com/docs/extensions/reference/api/permissions?hl=ja

I hope this helps with your extension!
Reply all
Reply to author
Forward
0 new messages