MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

proxy.registerProxyScript()

Registers a Proxy Auto-Configuration (PAC) file. The file is executed immediately, and its FindProxyForURL() function will be called for any HTTP, HTTPS, or FTP requests.

If PAC files are registered by more than one add-on, then requests will be passed initially to the one that was registered first.

  • If the FindProxyForURL() function in the first PAC returns "DIRECT" for a request, then the request will be passed unchanged to the FindProxyForURL() function in the next PAC.
  • If the FindProxyForURL() function in the first PAC proxies the request by returning "PROXY" or some other proxying value, then the proxy URL will be passed to the FindProxyForURL() function in the next PAC.

This is an asynchronous function that returns a Promise.

Syntax

var registering = browser.proxy.registerProxyScript(
  url   // string
)

Parameters

url
String. URL pointing to the PAC file to load. PAC files must be bundled with the add-on, and url must be relative to the add-on's manifest.json file.

Return value

A Promise that will be fulfilled with no arguments when the PAC file has been registered, or rejected if there was an error.

Browser compatibility

Examples

const proxyScriptURL = "proxy/proxy-script.js";

browser.proxy.registerProxyScript(proxyScriptURL).then();

Example Add-ons

Acknowledgements

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,