Opening an HTML file on Android
You got report.html in Gmail, Slack or a download. You tap it, and one
of four things happens:
- You see raw markup — angle brackets and all.
- Nothing happens, or Android says no app can open this file.
- It opens in a browser but is unstyled — black text, blue links,
images missing.
- It opens blank.
Each has a different cause. The first two are about which app gets the
file. The last two are about the file itself, and no Android setting fixes
them.
Step 1: get it into a browser, not a viewer
Android doesn't have one default app for local HTML. Gmail's attachment
preview, text editors, and most apps called "HTML Viewer" show the
source, not the page. You need a browser.
- Save the file. In Gmail, tap the download icon on the attachment,
so it lands in
Download/.
- Open your file manager — Files by Google on Pixel and most phones,
My Files on Samsung.
- Tap the file and pick Chrome (or Samsung Internet) from the
Open with list.
- Not offered? Long-press → ⋮ → Open with and choose the browser
explicitly. If you previously picked "Always" for a text app, clear it
under Settings → Apps → that app → Open by default.
Some phones list a system "HTML Viewer" in that chooser. It is a
bare-bones renderer for simple markup — expect scripts and anything
interactive not to work. Pick the real browser.
Step 2: if it opens but looks broken
Unstyled, missing images, or blank: it was never one file
Most tools that produce "an HTML report" produce a folder —
index.html plus css/, js/, data/ and images. Playwright, Allure,
coverage reports (genhtml, coverage.py), Sphinx, nbconvert with
external assets and Storybook all do. Send only the .html and every
reference in it points at a file that isn't on the phone.
Why even the full folder doesn't help on Android
On a laptop, file:///…/index.html can at least load
file:///…/css/style.css next to it. On Android, the Files app hands
Chrome the file through a content:// URI — a handle to one file,
with no folder behind it. A relative style.css resolves to a
content:// address the file provider doesn't serve, so it fails even if
you unzipped the whole folder onto the phone.
And reports that fetch their data at view time (fetch('data.json')) hit
the same wall that breaks them on a desktop — a local file has an
opaque origin, so the request is refused. See
the same-origin policy and file:// and
CORS error: origin 'null'.
"Can't I just type the path into Chrome?"
file:///sdcard/Download/report.html used to work. Since scoped
storage (Android 10 and 11), Chrome generally can't read shared storage
by path, and you get ERR_ACCESS_DENIED or ERR_FILE_NOT_FOUND. Don't
spend time on it.
Opens, but tiny
That's the page, not Android — a desktop layout with no viewport tag.
See HTML report is tiny on a phone.
The fix that works on every phone: a URL
A browser is very good at opening web pages and very bad at opening local
files. So stop sending a file.
Whoever has the report on a computer drags the file — or the whole output
folder, or a zip — into Comma and sends the
link:
index.html becomes the report, assets upload alongside it, and
relative references are rewritten to the uploaded copies — so the CSS,
images and data come with it.
- Scripts run in a sandboxed iframe, so interactive reports (sortable
tables, charts, expandable failures) stay interactive on the phone.
- It opens in Chrome on Android exactly like any other page. No download,
no Files app, no Open with.
Want to keep it as a file instead? The free
HTML inliner folds a report folder into one
self-contained .html with the CSS, JavaScript and images embedded —
that file survives being attached and opens from the Files app. It can't
fix a report that fetches data at runtime; for those, use the link.
Is it safe to open?
An .html file can carry scripts, and opening it in your browser runs
them on your device. Treat it like any attachment: only from senders you
trust. Comma renders report HTML in a sandboxed iframe with no
same-origin access, so a script in a report can't reach your session,
cookies or storage — a containment boundary, not a malware scanner.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited
revision history. Readers don't need an account to view a shared link.
Turn the file into a link →
Related