1

I am building a chrome extension that will parse through the HTML of whatever website the user is viewing for metadata.

I am super new at using the chrome API, and I am trying to figure out how to use chrome.pageCapture.saveAsMHTML(object details, function details). These parameters are pretty confusing to me.... I was trying to use http://developer.chrome.com/extensions/pageCapture but I haven't figured it out yet.

How do i assign the MHTML to a variable so that I can begin parsing?

VegasFun
  • 195
  • 3
  • 13
  • Why would you want to do it this way? Inject a content script, parse `document` as you wish. – Xan Jun 09 '14 at 18:37
  • @Xan, thanks for the input! I am simply trying to pull metadata from webpage using A Google Chrome extensions. I am not sure the best way to go about it. I am open to exploring different solutions for this. – VegasFun Jun 09 '14 at 18:48
  • 1
    Read the [Architecture Overview](https://developer.chrome.com/extensions/overview#arch) and try using content scripts. – Xan Jun 09 '14 at 18:50

1 Answers1

-2
chrome.pageCapture.saveAsMHTML({ tabId: tab.id }, async (blob) => {
    const content = await blob.text();
    const url = "data:application/x-mimearchive;base64," + btoa(content);
    chrome.downloads.download({
        url,
        filename: 'filename.mhtml'
    });
});
TSO
  • 1
  • 1