browser object in your config file.
This allows you to use the full power of Firefox’s extension APIs without creating a separate extension.
Overview
Thebrowser API is available globally in your Glide config:
Key Differences from Standard API
While thebrowser object in Glide is mostly compatible with the standard Web Extensions API, there are some important differences:
All Methods Return Promises
All method calls return aPromise<T>, even if the standard API returns a value synchronously:
Unsupported APIs
Some APIs are not supported:browser.runtime.connect()- Port-based messaging is not available- Any other Port-related APIs
browser.runtime.getFrameId()- Requires non-cloneable target argumentbrowser.runtime.getBackgroundPage()- Not accessible from main thread
Event Listeners
Event listeners are not supported in the content frame. You can only register event listeners in the main config:Availability Restrictions
Currently, thebrowser API has similar restrictions to standard web extensions and will not function on certain protected pages:
about:configaddons.mozilla.org- Other privileged pages
Common Use Cases
Tabs Management
Create, query, and manipulate tabs:Theme Customization
Dynamically update the browser theme:Script Injection
Execute JavaScript in web pages:CSS Injection
Inject custom styles into web pages:Bookmarks
Manage browser bookmarks:History
Access and manage browsing history:Cookies
Manage browser cookies:Storage
Store persistent data:Downloads
Manage downloads:Notifications
Display system notifications:Context Menus
Create custom context menu items:Web Requests
Intercept and modify network requests:Available Namespaces
Thebrowser object includes the following major namespaces:
browser.tabs- Tab managementbrowser.windows- Window managementbrowser.bookmarks- Bookmark operationsbrowser.history- Browsing historybrowser.cookies- Cookie managementbrowser.storage- Persistent storagebrowser.downloads- Download managementbrowser.notifications- System notificationsbrowser.theme- Browser theme customizationbrowser.scripting- Script and CSS injectionbrowser.contextMenus- Custom context menusbrowser.webRequest- Network request interceptionbrowser.sessions- Session managementbrowser.contextualIdentities- Container tabsbrowser.search- Search engine accessbrowser.runtime- Extension runtimebrowser.i18n- Internationalizationbrowser.permissions- Permission management
Runtime Information
Complete Example
Here’s a comprehensive example combining multiple browser APIs:See Also
- MDN Web Extensions API
- glide.content.execute() - Execute functions in content context
- glide.tabs - Glide’s higher-level tab API