Firefox logo

declarativeNetRequest available in Firefox

The declarativeNetRequest (DNR) extension API is now available to all extensions starting from Firefox 113, released last week. Extensions with functionality that can be expressed in terms of declarative rules are highly encouraged to transition to the DNR API. Documentation is available at declarativeNetRequest (MDN).

DNR allows extensions to declare rules that describe how the browser should handle network requests. These rules enable Firefox to process network requests without involving the extension further. In comparison with the blocking webRequest API, this offers the following benefits:

  • Privacy: Blocking network requests without host permissions. DNR offers more privacy by design because extension code does not get direct access to the request details. Thus request blocking functionality can be offered without requiring scary host permissions. This feature is especially useful in Manifest Version 3, where host permissions are available on an opt-in basis.
  • Performance: Network requests are not blocked on extension startup and response. DNR rules are evaluated independent of extension scripts. A background page is therefore not required. This characteristic is especially important for the reliability of extensions on Android, because the Android OS may terminate the background page outside of the control of the extension and browser.
  • Cross-browser: DNR is the only extension API for handling network requests that is available across the major browsers. Other than Firefox, DNR is also supported by Safari and Chromium-based browsers such as Chrome and Edge.

Some extensions require more flexibility than DNR offers, and we are committed to supporting both the DNR and blocking webRequest APIs to ensure that Firefox users have access to the best privacy tools available.

What’s next

The DNR implementation is not final. We are working on further optimizations and additional functionality, which are tracked as dependencies of bug 1687755. Our work is not limited to Firefox; where it makes sense we try to establish cross-browser consensus in the WebExtensions Community Group (WECG), as seen at WECG issues with topic:dnr.

Are you interested in experimenting with the declarativeNetRequest API? Try out one of the examples at New to Firefox extension development? See the Test and debug section of the Extension Workshop to get started.

3 comments on “declarativeNetRequest available in Firefox”

  1. Juraj M. wrote on

    Good job finishing this before ESR 115 is out :).
    But I see there is still a lot of unfinished work in the bug 1687755, you should probably ask for more developers 🙂

    PS: any news/plans for the “” API? 🙂

    1. Rob Wu wrote on

      The `` will be available in Firefox 115. The initial implementation is already available in the latest Firefox Nightly.

  2. zakius wrote on

    using internal engine to block quickly and privately is good, though we need to configure these rules on runtime and make them contextual (like block third party requests on all websites, except ones to X and ones made by Y to Z for example), essentially make uBO native