How to enable host permissions for all websites in chrome extensions?

Sudipmodi
1 min readOct 20, 2022

--

There are three kinds of permissions available in the manifest file of a chrome extension.

  1. permissions
  2. optional permissions
  3. host permissions

Host permissions contains an array of match patterns that enable the extension to run on one or more specified hosts. In the context of chrome extensions host means websites. Once you specify some match patterns, chrome will enable your extension whenever a user (who has installed your extension) visits a website that matches one or more of those patterns.

To let your extension run on all websites. You need to write your host permissions in the manifest file like this:

{

.

.

.

.

“host_permissions”: [ “<all_urls>”]

}

This will match all URLs. If you need to use only http and https urls you can use host permissions in your manifest file like this:

{

.

.

.

.

“host_permissions”: [“http://*/*”,“https://*/*”]

}

I hope this was useful, don’t forget to clap 👏.

--

--

Sudipmodi
Sudipmodi

Written by Sudipmodi

Full stack engineer and SAP consultant based out of bangalore.

No responses yet