chrome.pageCapture
For information on how to use experimental APIs, see the chrome.experimental.* APIs page.
The pageCapture API allows you to save a tab as MHTML.
MHTML is a standard format
supported by most browsers. It encapsulates in a single file a page and all
its resources (CSS files, images..).
Note that for security reasons a MHTML file can only be loaded from the file
system and that it can only be loaded in the main frame.
Manifest
You must declare the "pageCapture" permission
in the extension manifest
to use the history API.
For example:
{
"name": "My extension",
...
"permissions": [
"pageCapture"
],
...
}
API reference: chrome.pageCapture
Properties
getLastError
chrome.extensionlastError
Methods
saveAsMHTML
void
chrome.pageCapture.saveAsMHTML(, object
details, function
callback)
Undocumented.
Saves the content of the tab with given id as MHTML.
Parameters
-
details
(
optional
enumerated
Type
array of
object
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
tabId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The id of the tab to save as MHTML.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
-
-
-
callback
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
- Called when the MHTML has been generated.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(blob mhtmlData) {...};
-
mhtmlData
(
optional
enumerated
Type
array of
blob
)
-
Undocumented.
- The MHTML data as a Blob.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
Events
event name
chrome.bookmarksonEvent.addListener(function(Type param1, Type param2) {...}, Type opt_param1, Type opt_param2);
Undocumented.
A description from the json schema def of the event goes here.
Extra parameters to addListener
Listener returns