Browser
The Browser
variable contains functions relating to browsers on the desktop. With this api, you can query open tabs across all browsers and carry out simple operations such as focusing and closing tabs.
All tabs
Returns an array of all open tabs.
var tabs = Browser.allTabs;
if (tabs.length > 0)
Debug.showDialog(tabs.length + " tabs open. First one is " + tabs[0].title + " in the browser " + tabs[0].browserName);
Tabs grouped by browser
Returns an object where each key is a browser name and the values are arrays of tabs for that browser.
The keys will be among the following:
chrome
edge
krom
kant
firefox
var tabs = Browser.tabsByBrowser;
if (tabs.chrome && tabs.chrome.length > 0)
Debug.showDialog(tabs.chrome.length + " chrome tabs found. First one is " + tabs.chrome[0].title);
Visible browsers
Returns the names of browsers that are currently visible to Manatee (i.e. have the Sirenia extension installed and running).
var visibleBrowsers = Browser.visibleBrowsers;
Debug.showDialog("Visible browsers: " + visibleBrowsers.join(", "));
Focus a tab
Focuses the tab in question.
var tab = _.find(Browser.allTabs, { title: "My awesome tab" });
if (tab) tab.focus();
Close a tab
Closes the tab in question.
var tab = _.find(Browser.allTabs, { title: "My awesome tab" });
if (tab) tab.close();
Get the title of a tab
Returns the title of the tab in question.
var someFFTab = _.find(Browser.allTabs, { browserName: "firefox" });
if (someFFTab) Debug.showDialog("The title of the tab is " + someFFTab.title);
Get the URL of a tab
Returns the URL of the tab in question.
var tab = _.find(Browser.allTabs, { title: "My awesome tab" });
if (tab) Debug.showDialog("The URL of the tab is " + tab.url);
Get the browser name of a tab
Returns the name of the browser where the tab in question resides
var tab = _.find(Browser.allTabs, { title: "My awesome tab" });
if (tab) Debug.showDialog("The browser name of the tab is " + tab.browserName);
Get the incognito state of a tab
Returns the incognito state of the tab in question.
var tab = _.find(Browser.allTabs, { title: "My awesome tab" });
if (tab && tab.incognito) Debug.showDialog("The awesome tab is running in incognito mode: " + tab.title);