flypod

How to share an HTML file as a link (so it opens as a page)

Send an HTML file and the other person often gets code or a download. Why that happens, how to check a link, and one command that turns the file into a page.

4 min read

How to share an HTML file as a link, so it opens as a page, not as code. Below it: $ npx flypod index.html

You send someone an HTML file: a report your agent wrote, a prototype, a one-page invoice. They reply with a screenshot of angle brackets, or ask what to do with the download.

We make flypod, a small command that puts what you made online as a link someone else can open: a website, a Markdown doc, a slide deck, a page of charts. In the 30 days to December 3, about 1 in 8 new flypod sites (13%) was a single file, so this is a question we answer a lot.

The answer, in short:

  1. A browser shows a page only when the server says it is one. It reads the Content-Type header, not the .html in the name.
  2. Attachments and most file-sharing links hand over a file, not a page. The reader gets a save prompt, or the source as text.
  3. To share it as a page, put it on a web host. npx flypod index.html prints a link in a couple of seconds, with no account.
  4. Keep it to one file, or send the folder. Inline the CSS, scripts and small images; a page that loads other files needs them uploaded too.
  5. Any file name works. A lone report.html opens at the bare link, so there is nothing to rename.
  6. Check any link in one line: curl -sI <link> | grep -i content-type should say text/html.
  7. Without an account the link lasts 14 days. Signing in is free and keeps it for 6 months after its last deploy.

Why does my HTML file show up as code or a download?

Because of a header the reader never sees. When a browser opens a link, the server answers with the file and a Content-Type that says what it is. text/html means “draw this as a page”. text/plain means “show these characters”, tags and all.

A second header can overrule the first. Many file-sharing links send Content-Disposition: attachment, and the HTTP standard is clear about what that means. In RFC 6266: “If the disposition type matches “attachment” (case-insensitively), this indicates that the recipient should prompt the user to save the response locally, rather than process it normally (as per its media type).”

So the file arrives intact, and it is still not a page. An email attachment is the same: a file to save and open, not a link to tap.

Put it somewhere that serves it as a page. From the folder the file is in:

npx flypod index.html

This is the real output, from a demo we made for this post:

  · Uploading 3.8 KB
  ✓ Deployed in 2.0s · 1 file · 3.8 KB

  https://63545c92ff8041b7.flypod.page

  expires   6 months         after the last deploy (free plan)
  update    flypod update    publishes a new version · same URL

We ran it signed in to a free account, so it says 6 months. Without an account the same command works and the link lasts 14 days.

Ask the server what it sends. This is the check on that demo link:

$ curl -sI https://63545c92ff8041b7.flypod.page | grep -i content-type
content-type: text/html; charset=utf-8

If a link you are about to send says text/plain, or the full headers show content-disposition: attachment, the other person will not see your page.

What breaks when the page is more than one file?

Everything the page loads from beside it. A page that links style.css or images/logo.png looks right on your laptop because those files sit next to it. Upload only the HTML and they are missing, so the page arrives without styles or pictures. Paths that point at your own disk, like file:///C:/Users/…, break anywhere but your machine.

Two ways out:

  • Make it one file. Put the CSS in a <style> tag, the scripts in <script> tags, and small images inline as data URIs.
  • Send the folder. Put the page and everything it loads in one folder and deploy that: npx flypod ./my-page.

Do I have to rename it to index.html?

No. When you deploy one HTML file, flypod serves it at the link itself, whatever it is called, and at its own name too. We published a review report our agent wrote as report.html, and the bare link opens it. A page that is the entry to a folder of pages still wants to be called index.html.

Anyone with the link can open the page, so do not put anything private in it. A link made without an account is unlisted (search engines are told not to index it) and lasts 14 days. npx flypod login is free and keeps it on your account for 6 months after its last deploy, and every new deploy starts the 6 months over. Deploying again from the same folder updates the page behind the same link.

When the page is a preview for a client and should not open for anyone who gets hold of the link, flypod Pro ($5 a month) adds a password to the site and lets it run on your own domain.

Can my coding agent do this for me?

Yes. Ask it in plain words: “put this page online with npx flypod and give me the link”. An agent adds --json and gets the link back as one line of JSON, so it can check the page before it hands you the link. The short version of all this, with the questions people ask most, is on share an HTML file as a link.

This article was created with the help of AI. Every number, quote and command in it was checked against flypod’s own records, RFC 6266 and a real deploy before publishing.

Sergio Serrano

Sergio Serrano builds flypod, which puts what people and their coding agents make online as a link someone else can open. On this blog: what coding agents actually do with developer tools, measured from flypod's own numbers.