Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistently link DNR examples #26802

Merged
merged 1 commit into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Ruleset ID for the dynamic rules added by the extension using {{WebExtAPIRef("de

Its value is `"_dynamic"`.

{{WebExtExamples}}
{{WebExtExamples("h2")}}

## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The time interval within which {{WebExtAPIRef("declarativeNetRequest.MAX_GETMATC

Its value is `10`.

{{WebExtExamples}}
{{WebExtExamples("h2")}}

## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The minimum number of static rules guaranteed to an extension across its enabled

Its value is `30000` on Chrome.

{{WebExtExamples}}
{{WebExtExamples("h2")}}

## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Values of this type are objects. They contain these properties:
- For a rule originating from the set of dynamic rules, the value defined in {{WebExtAPIRef("declarativeNetRequest.DYNAMIC_RULESET_ID")}}, i.e., `"_dynamic"`.
- For a rule originating from the set of session rules, the value defined in {{WebExtAPIRef("declarativeNetRequest.SESSION_RULESET_ID")}}, i.e., `"_session"`.

{{WebExtExamples("h2")}}

## Browser compatibility

{{Compat}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The number of times {{WebExtAPIRef("declarativeNetRequest.getMatchedRules")}} ca

Its value is `20`.

{{WebExtExamples}}
{{WebExtExamples("h2")}}

## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ In Firefox, each ruleset has its own quota.

Its value is `5000`.

{{WebExtExamples}}
{{WebExtExamples("h2")}}

## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ An extension can change the number of enabled rulesets using the {{WebExtAPIRef(

Its value is `10`.

{{WebExtExamples}}
{{WebExtExamples("h2")}}

## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ In Firefox, this limit is evaluated separately per ruleset.

In Safari, there is no separate limit on the number of `regexFilter` rules.

{{WebExtExamples}}
{{WebExtExamples("h2")}}

## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The maximum number of static rulesets an extension can specify as part of the [`

Its value is `50`.

{{WebExtExamples}}
{{WebExtExamples("h2")}}

## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ In Chrome, `"append"` is supported for the following request headers:

In Firefox, the extension needs host permissions for the new value of the `Host` header.

{{WebExtExamples("h2")}}

## Browser compatibility

{{Compat}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Events have three functions:
- `rule`
- : {{WebExtAPIRef("declarativeNetRequest.MatchedRule", "MatchedRule")}}. Details of a matched rule.

{{WebExtExamples}}
{{WebExtExamples("h2")}}

## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Values of this type are objects. They contain these properties:
- `url` {{optional_inline}}
- : A `string`. The redirect URL. Redirects to JavaScript URLs are not allowed.

{{WebExtExamples("h2")}}

## Browser compatibility

{{Compat}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Values of this type are strings. Possible values are:
- `other`
- : Resources that aren't covered by any other available type.

{{WebExtExamples("h2")}}

## Browser compatibility

{{Compat}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Values of this type are objects. They contain these properties:
- `priority` {{optional_inline}}
- : `number`. Rule priority. Defaults to 1. When specified, should be >= 1. See [Matching precedents](/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest#matching_precedents) for details on how priority affects which rules are applied.

{{WebExtExamples("h2")}}

## Browser compatibility

{{Compat}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Values of this type are objects. They contain these properties:
- `type`
- : A `string`. The type of action to perform. Possible values are `"block"`, `"redirect"`, `"allow"`, `"upgradeScheme"`, `"modifyHeaders"`, and `"allowAllRequests"`. The use of the `"redirect"` and `"modifyHeaders"` actions require [host permissions](/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions#host_permissions) for the request and request initiator. The "block" and "upgradeScheme" actions also require host permissions unless the "declarativeNetRequest" permission is specified. Without these permissions, matching rules are ignored. See [Permissions at declarativeNetRequest](/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest#permissions) for more information. More details about the effects of rule actions are provided in [Matching precedents](/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest#matching_precedents).

{{WebExtExamples("h2")}}

## Browser compatibility

{{Compat}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ Domains specified in `initiatorDomains`, `excludedInitiatorDomains`, `requestDom

To programmatically generate the canonical domain for a URL, use the [URL API](/docs/Web/API/URL) and read its `hostname` property, i.e., `new URL(url).hostname`.

{{WebExtExamples("h2")}}

## Browser compatibility

{{Compat}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The ruleset ID for the session-scoped rules added by the extension.

Its value is `"_session"`.

{{WebExtExamples}}
{{WebExtExamples("h2")}}

## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ The `"declarative_net_request"` key is an object that must contain the `"rule_re
}
```

## Example extensions
<!-- Ideally we'd use the WebExtExamples template, but examples are not categorized by manifest keys yet - https://github.com/mdn/webextensions-examples/issues/524 -->

- [dnr-block-only](https://github.com/mdn/webextensions-examples/tree/master/dnr-block-only)
- [dnr-redirect-url](https://github.com/mdn/webextensions-examples/tree/master/dnr-redirect-url)

## Browser compatibility

{{Compat}}