content
content copied to clipboard
Add note about onBeforeRequest unavailability
Summary
Added that webRequest.onBeforeRequest is not avaliable in content scripts.
Motivation
I spent two hours trying to do this, and stumbled across the answer on a random stack overflow, seems pertinent.
Supporting details
https://stackoverflow.com/questions/40996014/typeerror-api-is-undefined-in-content-script-or-why-cant-i-do-this-in-a-cont
Related issues
Metadata
- [ ] Adds a new document
- [ ] Rewrites (or significantly expands) a document
- [x] Fixes a typo, bug, or other error
Preview URLs
Flaws
URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/onBeforeRequest
Title: webRequest.onBeforeRequest
on GitHub
Flaw count: 1
-
broken_links:
-
Can't resolve https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#webextension_apis
-
External URLs
URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/onBeforeRequest
Title: webRequest.onBeforeRequest
on GitHub
No new external URLs
@rebloor I think this is waiting on your review
@SenorGato apologies for missing the review request. I am wondering why we need a note on this event given that it's only one of many that aren't available in content scripts.
I'm not certain this is what we want to do. Content scripts have a limited set of APIs they are allowed to use. This same comment, if we addressed the issue this way, would need to be added to the majority of APIs.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#webextension_apis
@Josh-Cena as you can see, there are now two comments on this change querying how appropriate it is. We thank you for offering this suggestion, but on reflection, we shouldn't make it.
I think you've tagged the wrong person @rebloor (OP is @SenorGato) but I agree with your choice
Sorry @Josh-Cena