This API is experimental. It is only available to Chrome users on the
dev channel.
chrome.sessions
Description: |
Use the chrome.sessions API to query and restore tabs and windows from a browsing session.
|
Availability: |
Dev channel only.
|
Permissions: |
"sessions"
|
Types
Filter
properties |
integer |
(optional)
maxResults |
The maximum number of entries to be fetched in the requested list. Omit this parameter to fetch the maximum number of entries (sessions.MAX_SESSION_RESULTS).
|
Device
properties |
string |
info |
Represents all information about a foreign device.
|
array of Session |
sessions |
A list of open window sessions for the foreign device, sorted from most recently to least recently modified session.
|
Properties
25 |
chrome.sessions.MAX_SESSION_RESULTS |
The maximum number of sessions.Session that will be included in a requested list.
|
Methods
getRecentlyClosed
chrome.sessions.getRecentlyClosed( Filter filter, function callback)
Gets the list of recently closed tabs and/or windows.
Parameters |
Filter |
(optional)
filter |
|
function |
callback |
The callback parameter should be a function
that looks like this:
function(array of Session sessions) {...};
array of Session |
sessions |
The list of closed entries in reverse order that they were closed (the most recently closed tab or window will be at index 0 ).The entries may contain either tabs or windows.
|
|
getDevices
chrome.sessions.getDevices( Filter filter, function callback)
Retrieves all devices with synced sessions.
Parameters |
Filter |
(optional)
filter |
|
function |
callback |
The callback parameter should be a function
that looks like this:
function(array of Device devices) {...};
|
restore
chrome.sessions.restore(string sessionId, function callback)
Reopens a windows.Window or tabs.Tab, with an optional callback to run when the entry has been restored.
Parameters |
string |
(optional)
sessionId |
The windows.Window.sessionId, or tabs.Tab.sessionId to restore.
|
function |
(optional)
callback |
If you specify the callback parameter, it should
be a function that looks like this:
function( Session restoredSession) {...};
|