pageCapture

The pageCapture permission allows an extension to save a tab's content as an MHTML (MIME HTML) blob.

What it does

  • Captures the full content of a specified tab, including all its subresources (images, CSS, etc.).
  • Saves this content into a single MHTML file blob. MHTML is a web page archive format that bundles all resources into one file.
  • The resulting blob can be processed further, for example, by being saved to the user's disk or uploaded to a server.

When to use it

This is for extensions that need to create a complete, self-contained archive of a web page.

Examples:

  • A "web clipper" or "save page for later" extension that saves an offline copy of an article.
  • A testing tool that archives the state of a web application for bug reporting.
  • A research tool that saves pages for archival purposes.

Manifest Declaration

This permission requires host permissions for the pages you want to capture.

{
  "name": "My Web Clipper",
  "version": "1.0",
  "manifest_version": 3,
  "permissions": [
    "pageCapture"
  ],
  "host_permissions": [
    "<all_urls>"
  ]
}

Security & Privacy

Why is it risky?

This permission allows an extension to save a complete copy of a webpage as a single file. To do this, it must be able to read everything on the page, including text, images, and the underlying code.

A legitimate "web clipper" uses this to save articles for you to read later. However, a malicious extension could use this to secretly capture and read the contents of your private emails, social media pages, or online banking sessions. The risk is high if the extension asks for permission to do this on all sites.

API Usage Example

This example saves the content of the currently active tab as an MHTML blob when the user clicks the extension's icon.

// background.js

chrome.action.onClicked.addListener((tab) => {
  chrome.pageCapture.saveAsMHTML({ tabId: tab.id }, (mhtmlData) => {
    if (chrome.runtime.lastError) {
      console.error(chrome.runtime.lastError.message);
      return;
    }

    // mhtmlData is a Blob containing the MHTML content.
    // We can create a URL for it and download it.
    const url = URL.createObjectURL(mhtmlData);
    chrome.downloads.download({
      url: url,
      filename: `${tab.title || 'capture'}.mhtml`,
      saveAs: true
    });
  });
});

// Note: This example also requires the 'downloads' permission.
//
// Caveat: `URL.createObjectURL` is not available in MV3 service workers
// in some Chrome versions. If `chrome.downloads.download` rejects, read
// the blob in an offscreen document (reasons: ['BLOBS']) and either save
// it from there or convert it to a data URL before passing it to
// `chrome.downloads.download`.

Extensions with the pageCapture permission

Here are some popular browser extensions that use the "pageCapture" permission. To explore more, try our Advanced search.

Permission Metrics

Popularity

Security Risk


Usage by Platform