Browser Extension
The Browser Extension API provides developers with deeper integration into the user's Browser via a Browser Extension.
Some users might not have installed the Browser Extension. If a user doesn't have the Browser Extension installed, they will be asked if they want to install it when your extension calls the Browser Extension API. If the user doesn't wish to install it, the API call will throw an error.
You can check if a user has the Browser Extension installed using environment.canAccess(BrowserExtension)
.
API Reference
BrowserExtension.getContent
Get the content of an opened browser tab.
Signature
Example
Parameters
Name | Description | Type |
---|---|---|
options | Options to control which content to get. |
|
options.cssSelector | Only returns the content of the element that matches the CSS selector. |
|
options.format | The format of the content. |
|
options.tabId | The ID of the tab to get the content from. If not specified, the content of the active tab of the focused window is returned. |
|
Return
A Promise that resolves with the content of the tab.
BrowserExtension.getTabs
Get the list of open browser tabs.
Signature
Example
Return
A Promise that resolves with the list of tabs.
Types
BrowserExtension.Tab
Properties
Property | Description | Type |
---|---|---|
active* | Whether the tab is active in its window. There can only be one active tab per window but if there are multiple browser windows, there can be multiple active tabs. |
|
id* | The ID of the tab. Tab IDs are unique within a browser session. |
|
url* | The URL the tab is displaying. |
|
favicon | The URL of the tab's favicon. It may also be |
|
title | The title of the tab. It may also be |
|
Last updated