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 extension, 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 theFindProxyForURL()
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 theFindProxyForURL()
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 extension, andurl
must be relative to the extension'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
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Examples
const proxyScriptURL = "proxy/proxy-script.js"; browser.proxy.registerProxyScript(proxyScriptURL).then();
Example extensions
Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.