Host permissions and content script matching are based on a set of URLs defined by match
patterns. A match pattern is essentially a URL that begins with a permitted scheme (
ftp, and that can contain '
*' characters. The special pattern
any URL that starts with a permitted scheme. Each match pattern has 3 parts:
fileURLs isn't automatic. The user must visit the extensions management page and opt in to
fileaccess for each extension that requests it.
*; if the scheme is
file, there is no host part
/foo/bar. The path must be present in a host permission, but is always treated as
Here's the basic syntax:
:= :// := '*' | 'http' | 'https' | 'file' | 'ftp' | 'urn' := '*' | '*.' + := '/'
The meaning of '
*' depends on whether it's in the scheme, host, or path part. If the
*, then it matches either
https, and not
urn. If the
host is just
*, then it matches any host. If the host is
*._hostname_, then it matches the
specified host or any of its subdomains. In the path section, each '
*' matches 0 or more
characters. The following table shows some valid patterns.
urn scheme is available since Chrome 91.
|Pattern||What it does||Examples of matching URLs|
|Matches any URL that uses the ||http://www.google.com/|
|Matches any URL that uses the ||http://example.com/foo/bar.html|
|Matches any URL that uses the ||https://www.google.com/foo/baz/bar|
|Matches the specified URL||http://example.org/foo/bar.html|
|Matches any local file whose path starts with ||file:///foo/bar.html|
|Matches any URL that uses the ||http://127.0.0.1/|
|Matches any URL that starts with ||http://mail.google.com/foo/baz/bar|
|Matches any URL that starts with ||urn:uuid:54723bea-c94e-480e-80c8-a69846c3f582|
|Matches any URL that uses a permitted scheme. (See the beginning of this section for the list of permitted schemes.)||http://example.org/foo/bar.html|
Here are some examples of invalid pattern matches:
|Bad pattern||Why it's bad|
|'*' in the host can be followed only by a '.' or '/'|
|If '*' is in the host, it must be the first character|
|Missing scheme separator ("/" should be "//")|
Some schemes are not supported in all contexts.