I'm working on a Chrome extension (Manifest V3) where I:
Capture the current tab using chrome.pageCapture.saveAsMHTML from the background page.
Send the MHTML data to an offscreen document, where I:
Parse and extract the HTML from the MHTML.
Modify the DOM (e.g. replacing <h1> content).
Reconstruct the MHTML with the modified HTML.
Create a Blob from the new MHTML and generate a blob: URL.
I then send the new blob: URL back to the content script and try to embed it in an iframe:
However, the iframe loads but its contentDocument.body is null — it doesn’t render anything.
Is there any way to render an MHTML file (a modified one) inside an <iframe> in a content script or extension page?
Is the restriction on iframes absolute (even within chrome-extension:// contexts)?