How htmlviewer.app shows HTML files without uploading them

The evidence behind the claims on the HTML viewer: what happens to a file, how scripts and remote files stay off, how to check that nothing is uploaded, what is tested, and the limits.

Updated

What happens to a file you open

A file you add, or code you paste, is read by the site's own code in a Web Worker, a background thread of your browser that starts when you first open a file or paste code. HTML is parsed with the open-source library parse5 8.1.1 and MHTML files with postal-mime 4.2.1. A ZIP archive is read by the viewer's own code, which checks the archive's directory before anything is unpacked, and decompressed with fflate 0.8.3. No server takes part.

Nothing you open, paste or type is stored. In this site's storage your browser keeps only your layout and width choices and your cookie choice, beside the copy of the site's own files that lets the viewer work offline.

The four frames

The page you open is never put into the tool page itself. It is shown in one of four frames, each a separate page of this site with its own security policy:

  1. Preview. The tool page cleans a copy of the document with DOMPurify 3.4.18, which removes scripts, event handlers, javascript: links, meta tags (meta refresh among them), <base>, <object>, <embed> and nested frames and keeps the styles, then writes the cleaned copy into the frame. The frame page's own policy lets no script run and nothing load from the internet, so anything the cleaning missed is still blocked. Each link in the copy is replaced by a placeholder, and the tool page watches for a click on one from outside the frame.
  2. Preview with remote files. After you choose Load remote files: a second script-free frame whose policy also allows images, stylesheets, fonts and media from the web.
  3. Sealed frame. After you choose Run scripts, the page runs with its scripts, and with its local files written in, in a frame that the browser treats as a separate site: it has no access to this site, its storage or your other tabs. No request can leave it. Requests, images from the web, forms and pop-ups are refused, and so is loading another site in the frame. The tool sends the document once, to the frame it has just made. A script that moves the frame to another page of this site gets an empty frame, because the site's pages refuse to be shown in a frame and the remote-files frame page receives no document that way, so a file's script cannot switch itself to the remote setting.
  4. Sealed frame with remote files. With both on, the page may load files from the internet and connect to servers over HTTPS, as a page in a tab can. It still cannot read this site, and forms and pop-ups stay refused.

In the preview, a link to another page in the folder opens that page, a link to a section scrolls to it, and a web link shows its address as text with an Open link button, which opens it in a new tab. Nothing else is followed. In the sealed frame, links that leave the page do nothing.

How to check that nothing is uploaded

  1. Go offline. Load the viewer, turn off Wi-Fi and open a file. It opens, which it could not do if the file had to reach a server.
  2. Watch the network. Open your browser's developer tools (in Chrome, Control+Shift+J, or Command+Option+J on a Mac), choose the Network tab and open a file. The page fetches its own code from htmlviewer.app and, if analytics is on, sends small requests to Google Analytics. None contains your file, its name or anything in it.
  3. Read the security policy. Every page of the site is sent with a Content-Security-Policy header that lets it send data only to htmlviewer.app and Google Analytics. The frame pages have stricter policies of their own, except the two that are used after you choose Load remote files.

A test runs the second check before each release: while Google Analytics runs, it opens a file with markers in its name, its text and an attribute, pasted code with a marker, and a script that writes one, and it fails if a marker appears in any request. The same test checks that no session recorder loads. There is no session recording, because a recorder could read the frame that shows your page.

How it is tested

The reader is tested on 19 test documents made for the purpose: 11 that must open and 8 that must be refused. The 11 are UTF-8 text (with and without a byte order mark), windows-1252 text (with a meta tag and without), UTF-16 and Shift_JIS text; a folder with two pages, a stylesheet that imports another, an image with srcset, a font and a script; the same folder as a ZIP; an MHTML file saved by Chromium and one written by hand; and a page with no doctype. The 8 are an empty file, a text file, a damaged ZIP, a damaged MHT file, a ZIP entry pointing outside its folder, a ZIP declaring 10 GB, a ZIP with no page, and elements nested 10,000 deep.

The 27 engine tests check what the reader returns for each of them. The 17 browser tests open every test document in the page and read its text and a style inside the frame. They check that with scripts off nothing in a hostile page (a script, an event handler, a javascript: link, a meta refresh, a web image and a web link) runs or sends a request; that with scripts on, requests, an image, a form, a pop-up and loading another site are refused and the script cannot read the tool page; that a remote stylesheet loads only after Load remote files; that an address a running script builds brings up Load remote files; that a print from the preview gets the web and email addresses of its links; that all four frames load offline; that the downloaded file holds the original image bytes; and that a page without a doctype is shown in quirks mode.

Last tested: November 30, 2026, in Chrome, Firefox and WebKit, the engine of Safari. Result: every test passed.

Limits

One page can be up to 20 MB, and everything added at once up to 100 MB and 5,000 files. A ZIP can hold up to 5,000 entries and 200 MB unpacked, checked against the sizes the archive declares before anything is unpacked, and an entry whose path points outside the archive is refused. A page with elements nested more than 512 deep, or with more than 250,000 elements, is refused as too large.

A PDF saved from the preview keeps the addresses of links to web and email addresses only: a link to another file of a folder or ZIP prints as plain text, and whether the links in a saved PDF can be clicked depends on the browser. In the sealed frame, a file that a script requests while it runs is not available. A file is read as MHTML only when its name ends in .mht or .mhtml.

The viewer does not load a website by its address, make share links or save your work, because each needs a server. Save as PDF makes one PDF at a time. Not tested yet: phones.

Frequently asked questions

Is it safe to open an HTML file someone sent me?

Here the file cannot run code or contact a server until you choose to let it, and when its scripts run they have no internet access unless you also choose Load remote files. What the page asks you to do is yours to judge: do not type a password or card number into a page from a file you did not expect.