declarativeNetRequest
I want to use the declarativeNetRequest API, and I have it working for chrome, but when I test it on firefox, its not working:
On chrome the new rule appears when I log currentRules, but on Firefox it's empty, not sure why it's not updating.
11 Replies
Found the solution. It's a simple host permission issue. Chrome gives you these permissions automatically when you're developing, but on firefox you have to give permission to each website.
@thecodingsloth has reached level 1. GG!
Hey @The Coding Sloth
Did you manage to get this to work? I have a similar case.
How can I use the declarativeNetRequest to generate dynamic rules that work on both chrome and Firefox? I want to redirect network calls to my local server JS script when I am prototyping, but when I am not, I want to use a static link to my website, I will have a toggle button to determine which URL to redirect to.
If I put this into the
background.ts
it works for chrome, every time I open a new tab it just redirects to google. But it doesn't work for firefox.
This is in my package.json
:
I did figure it out. It seems that by default Firefox doesn’t give this permission automatically like chrome
So you’ll need the user to allow these permissions
Hey, thank you for answering!
Gave +1 Rep to @The Coding Sloth (current:
#27
- 1
)Do you maybe have an example how to do that?
I figured it out, and it does work, thank you so much! 😄
Happy to help👍
https://github.com/The-CodingSloth/haha-funny-leetcode-extension here’s my repo just in case
GitHub
GitHub - The-CodingSloth/haha-funny-leetcode-extension
Contribute to The-CodingSloth/haha-funny-leetcode-extension development by creating an account on GitHub.
Thank you, I appriciate it!