Guide

Someone sent you an HTML file. Here is how to open it.

Tap it first. On iPhone the Files app previews HTML with Quick Look, which sometimes renders the page and sometimes shows raw code. JavaScript usually will not run.

On Android, tap the file in your file manager and pick Chrome. Some managers only show the source. If you get code instead of a page, upload the file to sharehtml.org (free, no account) and open the link in your browser. That is what the file wanted all along.

Sending files to someone on a phone? Send the link, not the file.

On iPhone and iPad

  1. Save the attachment to the Files app (tap, then the share icon, then Save to Files).
  2. Tap the file in Files. Quick Look opens it.
  3. If you see the page, done. If you see code, Quick Look has decided it is text.
  4. Safari cannot open a local file from Files directly. The reliable route is a link: upload the file to sharehtml.org from the share sheet or the Files picker and open the link in Safari.

Pages with JavaScript (charts, calculators, anything interactive) rarely run in Quick Look. They run from a link.

On Android

  1. Open the file manager (Files by Google, or the maker's own app).
  2. Tap the .html file. If asked, choose Chrome or another browser.
  3. If the manager shows the source, or "Open with" offers only text apps, upload the file to sharehtml.org and open the link in Chrome.

Chrome on Android can open file:// paths, but many managers hand the file to a text viewer instead. The behaviour differs per maker.

An HTML file is instructions for a browser. A phone's file viewer is not a browser. A link is served by a web server, which every browser understands. sharehtml.org keeps the file exactly as uploaded, on its own address, for free, with no expiry.

If you are the sender: WhatsApp, email, iMessage

Upload the file to sharehtml.org and send the link instead. It opens in one tap in every app above.

Is it safe to open?

An HTML file from disk can only see itself. A link on sharehtml.org runs on its own origin and cannot read cookies or storage from sharehtml.org or from any other page. If the sender is unknown to you, treat the file like any attachment: do not enter passwords into it.

Questions

How do I open an HTML file in Safari on iPhone?

Safari has no "open file" button. Quick Look from Files is the only local route. A link opens in Safari directly.

How do I open an HTML file on iPad?

Same as iPhone: Files, then Quick Look; or upload and open the link.

Can I send an HTML file on WhatsApp?

You can, as a document. It will not render. Send a sharehtml.org link instead; WhatsApp shows a preview and opens it in the browser.

Can I send an HTML file by email so it opens as a page?

Not reliably. Attach it for developers; send a link for everyone else.