chrome.pageCapture

Description: Use the chrome.pageCapture API to save a tab as MHTML.
Availability: Since Chrome 26.
Permissions: "pageCapture"

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 pageCapture API. For example:

      {
        "name": "My extension",
        ...
        "permissions": [
          "pageCapture"
        ],
        ...
      }
      

Summary

Methods
saveAsMHTML chrome.pageCapture.saveAsMHTML(object details, function callback)

Methods

saveAsMHTML

chrome.pageCapture.saveAsMHTML(object details, function callback)

Saves the content of the tab with given id as MHTML.

Parameters
object details
integer tabId

The id of the tab to save as MHTML.

function callback

Called when the MHTML has been generated.

The callback parameter should be a function that looks like this:

function(binary mhtmlData) {...};
binary (optional) mhtmlData

The MHTML data as a Blob.