Google Chrome contains some functionality in its chrome.webrequest API (e.g., http://developer.chrome.com/extensions/samples.html#12a7bf1490a26359eadf10917e37c5b9 ) that can be used to redirect certain URLs to a specified web page. The Chrome extension uses a blocking event listener (chrome.webRequest.onBeforeRequest.addListener) and does a redirect for targeted URLs. How might I do something similar in a FireFox Add-on?
This question was asked for a very long time. I'm not sure if there was solution for this at then. But now we can do such things using Firefox WebExtensions API.
It is compatible with Chrome in most APIs (though some of them are not supported, or not fully supported).
For this very specific question, Firefox WebExtensions support webRequest API, you can use it like the way in Chrome:
chrome.webRequest.onBeforeRequest.addListener(...);
Note: To use
webRequest
API, you must have thewebRequest
permission in your manifest.json.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With