Chrome Proxy Extensions: Clearing an Override vs. Direct Mode
Clear the same Chrome extension setting scope that was set, and distinguish releasing that override from forcing a direct connection.
An extension that set a proxy in the regular scope can release that setting with:
chrome.proxy.settings.clear({ scope: 'regular' }, () => {
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError.message);
return;
}
chrome.proxy.settings.get({ incognito: false }, details => {
console.log(details.value, details.levelOfControl);
});
});
Run this in the extension’s permitted background context. If the override was set in an incognito scope, clear that same scope; clearing regular does not remove a separate incognito override.
clear releases the extension’s setting. Chrome can then use another applicable configuration, including system settings, command-line options, another extension or policy. A system proxy may therefore remain effective after a successful clear.
For an extension whose explicit feature is direct mode, setting mode: 'direct' expresses that choice while the extension retains control. Releasing control and selecting direct mode are different user actions, so connect the UI’s off or restore action to the intended one.