mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 14:28:33 +02:00
* Update `proxy-blocker` extension to be compatible with firefox 56+ * Change `DIRECT 1234` to `DIRECT` see bug https://bugzilla.mozilla.org/show_bug.cgi?id=1355198
proxy-filter
What it does
This add-on registers a PAC script using the proxy API.
The PAC script is initialized with a list of hostnames: it blocks requests to any hosts that are in the list.
The list is given the following default values: ["example.com", "example.org"], but the user can add and remove hosts using the add-on's options page.
Note that the hostname-matching is very simple: hostnames must exactly match an entry in the list if they are to be blocked. So with the default settings, "example.org" would be blocked but "www.example.org" would be permitted.
To try it out:
- install it
- try visiting
http://example.com, and see it is blocked - visit
about:addons, open the add-on's preferences, and try changing the hostnames in the text box - try visiting some different pages, to see the effect of your changes.
What it shows
- How to implement a simple PAC script, and register it using the proxy API.
- How to exchange messages between a PAC script and a background script.