Questions tagged [chrome-declarativenetrequest]

chrome.declarativeNetRequest API for Chrome browser extensions

Documentation: https://developer.chrome.com/extensions/declarativeNetRequest/

48 questions
1
vote
0 answers

Can't Toggle Static declarativeNetRequest Static Rules

I see that Google wants Chrome Extension developers to migrate from chrome.webRequest to chrome.declarativeNetRequest. I see static rules, but the trouble there is that how do we allow a user to toggle individual rules on or off per website? Most…
0
votes
0 answers

chrome.declarativeNetRequest: How to allow blocked URL

I want to make a Chrome extension that initially blocks the access to a specific website (e.g. example.com), and then, based on some conditions, it allows the user to access it. As a starting point, I have used the source code from Github that…
0
votes
0 answers

How to Rewrite the webRequest API with declarative_net_request API in Chrome Extension V3

I am trying to migrate my extension from V2 to V3. In V3 the webRequest API has been deprecated and replaced by declarative_net_request API. I want to rewrite the below code block using declarative_net_request API, but I don't have idea on how this…
0
votes
0 answers

Unable to block youtube with chrome's declarativeNetRequest API but I can redirect from it

I am trying to block youtube using chromes declarative Net Request API. While I can redirect from the youtube homepage I can still watch embedded videos in google.com or other websites. Trying to use the declarative Net Request to block youtube…
0
votes
1 answer

setting User-Agent with declarative net request is not working

I am trying to modify User-Agent with declarative net API and I have all the needed permission set and no error is showing but the user agent is still not changing. > manifest.json "permissions": [ "declarativeNetRequestWithHostAccess", …
0
votes
0 answers

declarative_net_request that redirects xmlhttprequest issue

I am having trouble getting a chrome extension that redirects REST API calls from one host to another. Specifically, trying to redirect POSTs that go to https://api.old.com/endpoint to get redirected to https://api.new.com/newapi. The…
0
votes
0 answers

declarativeNetRequest modifyHeaders issue for safari extension. Header is not recognized

Declarative net Request modify header rule is not working for safari. Works fine on all other browsers (chrome, edge , FF etc) Safari Version 16.5.2 (18615.2.9.11.10) manifest rule: "declarativeNetRequestWithHostAccess" Error: [Error] Error: Invalid…
surya
  • 991
  • 1
  • 12
  • 22
0
votes
0 answers

Prevent DNS query for requests that were redirected using chrome.declarativeNetRequest

I've noticed that even though requests are being redirected from host1 to host2 by chrome.declarativeNetRequest rule, host1 is still queried for DNS. I know this is not a bug, this level of control was not possible even before Manifest V3, but I…
0
votes
0 answers

block a request if the referer header is not equal to the domain

How to block a request if the referer header is not equal to the domain from which the request is made? This needs to be done for extensions with Manifest version 3, using declarativeNetRequest. const rules = blacklist.map((url, i) => { …
0
votes
1 answer

Exclude specific URLs from chrome.declarativeNetRequest redirect?

I've been trying to program a chrome extension that redirects the user to a specific YouTube video whenever they access YouTube. The problem is that currently, typing in 'youtube.com' results in 'ERR_TOO_MANY_REDIRECTS' instead of the specific…
0
votes
2 answers

Web request redirection to different data without opening the file using a chrome extension

There is a website called x. Upon opening website x it makes a request for a css file from website y. I am making a darkmode chrome extension for website x. I want to redirect the request website x is making to getting the css file data from my…
0
votes
0 answers

Chrome extension - How to know if own extension blocked page - manifest v3

When blocking pages with a pattern like so: chrome.declarativeNetRequest.updateDynamicRules({ addRules: [ { "id": 1, "priority": 1, "action": {"type": "block"}, "condition": { "urlFilter": "*://*/*lala.js", …
0
votes
0 answers

Can Chrome Extension block all network requests (including requests from other Extensions)?

By using following declarativeNetRequest request, one extension can block network requests from websites in tabs. [ { "id": 1, "priority": 1, "action": { "type": "block" }, "condition": { "urlFilter": "*", …
Jurosh
  • 6,984
  • 7
  • 40
  • 51
0
votes
0 answers

How to append query parameters to an URL using Chrome Extension's declarativeNetRequest API

I want to develop a chrome extension that allows to append a query parameter to a specific URL (i.e. from www.google.com to www.google.com?q=query). In Manifest v2 it was possible to accomplish it by using the webRequest API, but in Manifest v3 the…
0
votes
1 answer

chrome declarativeNetRequest append matched url not working

I'm trying to append the matched domain from a declarativeNetRequest rule to the redirect extension page, but I can't seem to be able to get it to work. The redirect is working to my extension page but the matched URL isn't appended. Here is my code…