The BrowserSetting.onChange event is fired when the setting is changed.
On Firefox, it doesn’t fire if the change has been made through about:config.
BrowserSetting.onChange.addListener(listener) BrowserSetting.onChange.removeListener(listener) BrowserSetting.onChange.hasListener(listener)
Events have three functions:
addListener(listener)removeListener(listener)listener argument is the listener to remove.hasListener(listener)listener is registered for this event. Returns true if it is listening, false otherwise.callbackA callback function that will be called when this event occurs. The function will be passed the following arguments:
detailsobject containing details of the change that occurred. Its properties are as follows: valuelevelOfControlstring. This represents the way the setting is currently controlled. You can use it to check whether you can modify the setting. See BrowserSetting.set() for details. Its value may be any of the following: "not_controllable" | Extensions are not allowed to modify this setting. |
"controlled_by_other_extensions" | Another extension that was installed after this one has modified this setting. |
"controllable_by_this_extension" | This extension is allowed to modify the setting. |
controlled_by_this_extension" | This extension has already modified the setting. |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
onChange |
Yes |
79 |
72 |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
Note: This API is based on Chromium's chrome.types API.
Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/types/BrowserSetting/onChange