<commit_before>---
layout: default-withsidebar
title: chrome.pageCapture
support: 18
copyright: opera-google-ccby
originalsource: http://developer.chrome.com/extensions/pageCapture.html
---


<div id="gc-pagecontent">
	
	
	
	<div id="toc">
		<ol>
			<li>
				<a href="#manifest">Manifest</a>
			</li>
			<div class="api-reference">
				<li>
					<a href="#apiReference">Reference</a>
					<ol>
						<li>
							<a href="#methods">Methods</a>
							<ol>
								<li><a href="#method-saveAsMHTML">saveAsMHTML</a></li>
							</ol>
						</li>
					</ol>
				</li>
			</div>
		</ol>
	</div>
	<table class="intro" id="intro">
		<tr>
			<td class="title">Description:</td>
			<td>
					
					
					Use the <code>chrome.pageCapture</code> API to save a tab as MHTML.
					
					
					
					<br>
			</td>
		</tr>
		<tr>
			<td class="title">Availability:</td>
			<td>
					
					
					
						Stable since Chrome 18.
					
					
					<br>
			</td>
		</tr>
		<tr>
			<td class="title">Permissions:</td>
			<td>
					
					<code class="code">
					"pageCapture"
					
					</code>
					
					<br>
			</td>
		</tr>
	</table>
<p>
MHTML is a <a href="http://tools.ietf.org/html/rfc2557">standard format</a>
supported by most browsers. It encapsulates in a single file a page and all
its resources (CSS files, images..).
</p>

<p>
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.
</p>

<h2 id="manifest">Manifest</h2>


<p>You must declare the "pageCapture" permission
in the <a href="manifest.html">extension manifest</a>
to use the pageCapture API.
For example:</p>
<pre class="prettyprint" data-filename="manifest.json">
{
"name": "My extension",
...
<b>"permissions": [
"pageCapture"
]</b>,
...
}
</pre>
	<h1 id="apiReference">chrome.pageCapture reference</h1>
	<div class="api_reference">
			<h2 id="methods">Methods</h2>
				<div>
					<h4 id="method-saveAsMHTML">
						saveAsMHTML
					</h4>
					
					<div class="summary uncapitalize">
					<div class="line">
					<code>chrome.pageCapture.saveAsMHTML</code>(<code>object <code class="variable">details</code></code>, <code>function <code class="variable">callback</code></code>)
					</div>
					</div>
					<div class="description">
						<p>
							Saves the content of the tab with given id as MHTML.
						</p><commit_msg>cleaned up pageCapture doc<commit_after>---
layout: default-withsidebar
title: chrome.pageCapture
support: 18
copyright: opera-google-ccby
originalsource: http://developer.chrome.com/extensions/pageCapture.html
---


<div id="gc-pagecontent">
	
<h2>Contents</h2>	
	
	<div id="toc">
		<ol>
			<li>
				<a href="#manifest">Manifest</a>
			</li>
			<li>
				<a href="#methods">Methods</a>
				<ol>
					<li><a href="#method-saveAsMHTML">saveAsMHTML</a></li>
				</ol>
			</li>
		</ol>
	</div>
	<table class="intro" id="intro">
		<tr>
			<td class="title">Description:</td>
			<td>
					
					
					Use the <code>chrome.pageCapture</code> API to save a tab as MHTML.
					
					
					
					<br>
			</td>
		</tr>
		<tr>
			<td class="title">Permissions:</td>
			<td>
					
					<code class="code">
					"pageCapture"
					
					</code>
					
					<br>
			</td>
		</tr>
	</table>
<p>
MHTML is a <a href="http://tools.ietf.org/html/rfc2557">standard format</a>
supported by most browsers. It encapsulates in a single file a page and all
its resources (CSS files, images..).
</p>

<p>
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.
</p>

<h2 id="manifest">Manifest</h2>


<p>You must declare the "pageCapture" permission
in the <a href="manifest.html">extension manifest</a>
to use the pageCapture API.
For example:</p>
<pre class="prettyprint" data-filename="manifest.json">
{
"name": "My extension",
...
<b>"permissions": [
"pageCapture"
]</b>,
...
}
</pre>
	<div class="api_reference">
			<h2 id="methods">Methods</h2>
				<div>
					<h4 id="method-saveAsMHTML">
						saveAsMHTML
					</h4>
					
					<div class="summary uncapitalize">
					<div class="line">
					<code>chrome.pageCapture.saveAsMHTML</code>(<code>object <code class="variable">details</code></code>, <code>function <code class="variable">callback</code></code>)
					</div>
					</div>
					<div class="description">
						<p>
							Saves the content of the tab with given id as MHTML.
						</p>
{'fraction_non_alphanumeric': 0.17282830573826263, 'fraction_numerical': 0.006804264005443411, 'mean_word_length': 2.811581676750216, 'pattern_counts': {'":': 4, '<': 178, '<?xml version=': 0, '>': 178, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1019247', 'n_tokens_mistral': 1994, 'n_tokens_neox': 1531, 'n_words': 396}