Disable notifications for a specific URL pattern (For incognito browsing)

Disable notifications for incognito mode
Disable notifications for incognito mode

Purpose of this tool

This tool will allow a user to control whether to allow a website to show desktop notifications (only while using incognito mode).

Requirements to use this tool

To use this tool, a user should have "Toolkit For Web Developer" chrome extension installed on their web browser.

To download and install "Toolkit For Web Developer", please visit our download page: Download Toolkit For Web Developer

Supported document types

Document type Supported
main document yes
iframe elements yes
shadow dom yes

Nested shadow elements and nested iframe elements are not fully supported by this tool.

This tool also does not support shadow root opened with the closed mode.

Available content settings

The default value for all sites is ask.

  • allow: Allow sites to show desktop notifications.
  • block: Don't allow sites to show desktop notifications.
  • ask: Ask when a site wants to show desktop notifications.

The primary URL is the URL of the document which wants to show the notification. The secondary URL is not used.

Additional permissions

Please grant permission to run our chrome extension in incognito mode to use this feature.

This permission can be granted to a chrome extension by following simple steps given below:

  • Visit extension management page.
  • Click on "Details" button.
  • Check the checkbox that says "Allow in incognito".

After that, this feature will be allowed to run in incognito mode as well.

Input parameters while adding or editing a rule

  • Rule name: Name of the rule to be saved in storage.
  • Primary pattern: primary pattern used for changing content setting.
  • Secondary pattern: secondary pattern used for changing content setting.
  • Content setting: a user can change content setting to different options such as Block, Ask or Allow and few others depending on requirements.

Information about primary and secondary patterns

Information regarding adding and editing an existing pattern is given below.

  • For http, https, and ftp URLs, the path must be a wildcard (/*). For file URLs, the path must be completely specified and must not contain wildcards.

  • Patterns can specify a port number. If a port number is specified, the pattern only matches websites with that port. If no port number is specified, the pattern matches all ports.

Pattern precedence

If there are more than one rules defined for a website that may collide with one another then rule with more specific pattern takes precedence.

For example, given below is the list of URL patterns organised in their precedence:

  1. https://www.toolkitforweb.dev/*
  2. https://*.toolkitforweb.dev/*
  3. <all_urls>

If a pattern is more specific than another pattern in one part but less specific in another part, the different parts are checked in the following order:

  • hostname
  • scheme
  • port

For example:

  1. http://www.example.com:*/*: hostname and scheme are more specific.
  2. *:/www.example.com:123/*: It specifies the hostname, but no scheme is specified so it takes lower precedence.
  3. http://*.example.com:123/*: It specifies the port and scheme but it has a wildcard in the hostname.

URLs taken into consideration while applying content setting

The URL taken into account when deciding which content setting to apply depends on the content type. For example, notification content settings are based on the URL shown in the omnibox. This URL is called the "primary" URL.

Some content settings take additional URL into consideration. For example content setting for cookies is dicided based on the URL of the HTTP request (Primary URL) as well as the URL shown in the omnibox (Secondary URL).

Precedence Primary pattern Secondary pattern
1 http://www.example.com/* http://www.toolkitforweb.dev.dev/*
2 http://www.example.com/* <all_urls>
3 <all_urls> http://www.toolkitforweb.dev.dev/*
4 <all_urls> <all_urls>

Information about pattern matching

A pattern is essentially a URL that begins with a permitted scheme (http, https, or file, and that can contain * characters. The special pattern <all_urls> matches any URL that starts with a permitted scheme.

File access: Access to file URLs is not automatically granted. The user must visit the extension management page and opt in to file access.

Each match pattern has 3 parts:

  • scheme — for example, http or *

  • host : for example, www.example.com or *.google.com or *; if the scheme is file, there is no host part

  • path : for example, /*, /foo*, or /foo/bar. The path must be present in a host permission, but is always treated as /*.

Here's the basic syntax:

<url-pattern> := <scheme>://<host><path>
<scheme> := '*' | 'http' | 'https' | 'file' | 'ftp'
<host> := '*' | '*.' <any char except '/' and '*'>+
<path> := '/' <any chars>

The meaning of * depends on whether it's in the scheme, host, or path part. If the scheme is *, then it matches either http or https, and not file, or ftp. 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.

Examples of valid pattern

Pattern: <all_urls>

Description: Matches any URL that uses a permitted scheme.

Matching URLs: http://example.com/foo/bar.html, file:///bar/baz.html

Pattern: *://abc.example.com/*

Description: Matches any URL that starts with http://abc.example.com or https://abc.example.com.

Matching URLs: http://abc.example.com/foo/baz/bar, https://abc.example.com/foobar


Description: Matches any URL that uses the http scheme and is on the host

Matching URLs:,

Pattern: file:///foo*

Description: Matches any local file whose path starts with /foo.

Matching URLs: file:///foo/bar.html, file:///foo

Pattern: http://example.com/foo/bar.html

Description: Matches the specified URL

Matching URLs: http://example.com/foo/bar.html

Pattern: https://*.example.com/foo*bar

Description: Matches any URL that uses the https scheme, is on a example.com host (such as www.example.com, docs.example.com, or example.com), as long as the path starts with /foo and ends with bar.

Matching URLs: https://www.example.com/foo/baz/bar, https://docs.example.com/foobar

Pattern: http://*/foo*

Description: Matches any URL that uses the http scheme, on any host, as long as the path starts with /foo.

Matching URLs: http://example.com/foo/bar.html http://www.example.com/foo

Pattern: http://*/*

Description: Matches any URL that uses the http scheme.

Matching URLs: http://www.example.com/, http://example.com/foo/bar.html

Information about bad patterns

Pattern: http://www.google.com

Why it is bad: No path

Pattern: http://*foo/bar

Why it is bad: * in the host can be followed only by a . or /.

Pattern: http://foo.*.bar/baz

Why it is bad: If * is in the host, it must be the first character.

Pattern: http:/bar

Why it is bad: Missing scheme separator (/ should be //)

Pattern: foo://*

Why it is bad: Invalid scheme.

Information about input parameters used by this tool

  • Rule name: Name of the rule. Rule name is used as an identifier.
  • Primary pattern: The primary pattern on which the rule must be applied. The user must enter correct primary pattern as documented above
  • Secondary pattern: The secondary URL pattern on which the rule must be applied. A user must enter correct secondary pattern as documented above.
  • Content setting: The value of the content setting, user must select the value of the content setting from the dropdown menu as documented above.
Other Posts