Setting Firefox Bookmark Keywords From an Extension, Without an API for It
I use bookmark keywords all day. Type "jira" in the address bar, hit enter, and you're on the board. Firefox gives a keyword the top "Visit" suggestion in the URL bar, so it's faster than any search or history match, and it syncs to every machine you're signed in on. When I wrote Passport Containers , a Firefox add-on for per-path container rules, I wanted to set the keyword right from the popup.…
Mozilla's Firefox browser supports bookmark keywords in the address bar, allowing users to quickly navigate to specific sites. These keywords are synced across all devices when using Firefox Sync. However, there is no API available to set these keywords directly from extensions within Firefox. The WebExtensions bookmarks API only allows for setting a title, URL, and parent folder, without including keywords, tags, or descriptions.
This limitation led to the development of a workaround by creating an extension called Passport Containers. The extension uses OAuth with scoped keys to access the Firefox Sync feature, decrypts the Sync key, and manipulates the bookmark record to include the desired keyword. This encrypted process ensures that the extension does not have access to the user's password.
Though there are some limitations, such as waiting for Firefox to sync the keyword after it is added to the server, the workaround provides a reliable solution for setting bookmark keywords from an extension without requiring an API.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.