files/en-us/mozilla/add-ons/webextensions/api/browseraction/getusersettings/index.md
Gets the user-specified settings for the browser action.
This is an asynchronous function that returns a Promise.
let userSettings = await browser.browserAction.getUserSettings();
This function takes no parameters.
A Promise that fulfills with an object with these properties:
userSettings
isOnToolbar {{optional_inline}}
boolean. Whether the user has pinned the action's icon to the browser UI. This setting does not indicate whether the action icon is visible. The icon's visibility depends on the size of the browser window and the layout of the browser UI.This code logs a message indicating whether the browser action is pinned or not:
function gotSettings(userSettings) {
if (userSettings.isOnToolbar) {
console.log("Browser action is pinned to toolbar.");
} else {
console.log("Browser action is not pinned to toolbar.");
}
}
let gettingUserSettings = browser.browserAction.getUserSettings();
gettingUserSettings.then(gotSettings);
{{WebExtExamples}}
{{Compat}}