Browser Extension
The Browser Extension API provides developers with deeper integration into the user's Browser via a Browser Extension.
API Reference
BrowserExtension.getContent
Get the content of an opened browser tab.
Signature
Example
Parameters
options
Options to control which content to get.
Object
options.cssSelector
Only returns the content of the element that matches the CSS selector. If the selector matches multiple elements, only the first one is returned. If the selector doesn't match any element, an empty string is returned. When using a CSS selector, the format
option can not be markdown
.
string
options.format
The format of the content. - html
: document.documentElement.outerHTML
- text
: document.body.innerText
- markdown
: A heuristic to get the "content" of the document and convert it to markdown. Think of it as the "reader mode" of a browser.
"html"
or "text"
or "markdown"
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.
number
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
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.
boolean
id*
The ID of the tab. Tab IDs are unique within a browser session.
number
url*
The URL the tab is displaying.
string
title
The title of the tab. It may also be undefined
if the tab is loading.
string
Last updated