temporary_user_name
temporary_user_name

Reputation: 37068

Can you access chrome:// pages from an extension?

When you're writing the manifest.json file, you have to specify matches for your content scripts. The http and https work fine, but if I try to include chrome://*/* or any variant of it, I get an error that I'm attempting to use an invalid scheme for my matches.

Is it not allowed?

Upvotes: 27

Views: 18050

Answers (4)

ishandutta2007
ishandutta2007

Reputation: 18214

@andrew-hall's solution doesn't work any more. Trying many options I was frustrated. Then thanks to @thomas-mueller, I found a chrome extension which can access chrome://extensions:

Here is the manifest of it:

{
    "update_url": "https://clients2.google.com/service/update2/crx",
    "name": "Disable All Extensions",
    "manifest_version": 3,
    "version": "1.4.3",
    "description": "Disable/Enable your chrome extensions with the click of a button.",
    "permissions": [
        "contextMenus",
        "management",
        "storage"
    ],
    "background": {
        "service_worker": "./src/background.js",
        "type": "module"
    },
    "icons": {
        "16": "./public/images/appOn_16.png",
        "48": "./public/images/appOn_48.png",
        "128": "./public/images/appOn_128.png"
    },
    "action": {
        "default_icon": "./public/images/appOff_16.png",
        "default-popup": "./public/index.html"
    },
    "author": "Blinkzy"
}

It's interesting it doesn't have matches whatsoever(not even content_scripts), and I was thinking it to be a mandatory field.

Upvotes: -1

Métoule
Métoule

Reputation: 14472

The authorized schemes for matches are http, https, file, ftp.
Therefore, chrome is not a valid scheme.

Upvotes: 7

Andrew Hall
Andrew Hall

Reputation: 3073

By default you cannot run on a chrome:// url page.

However, there is an option in chrome://flags/#extensions-on-chrome-urls:

Extensions on chrome:// URLs (Mac, Windows, Linux, Chrome OS, Android)
Enables running extensions on chrome:// URLs, where extensions explicitly request this permission.

You still have to specify pages that your extension can run on and wildcards are not accepted - so you have to specify the full URL eg chrome://extensions/

Upvotes: 38

James
James

Reputation: 4354

Yes, it is not allowed. You can't link to them from hrefs on a webpage either.

Upvotes: 1

Related Questions