How to share a single HTML file as a live link (and why it shows as code)
You made a page. A Claude artifact, a ChatGPT canvas, a Lighthouse report, a small calculator. Now you want to send it to someone, and it either downloads as a file or shows raw source code on their phone. Here's why th
You made a page. A Claude artifact, a ChatGPT canvas, a Lighthouse report, a small calculator. Now you want to send it to someone, and it either downloads as a file or shows raw source code on their phone.
Here's why that happens, and the quickest ways to share it as a live page.
Why a .html file won't just open
An HTML file only becomes a page when a browser loads it from a web address. Email it and it arrives as a file to download. Put it in Google Drive or Dropbox and you get a preview or a download, because running someone else's HTML on a storage domain would be a security hole. Google ended Drive web hosting back in 2016.
So you need a host whose job is to serve that file as a page.
Make it one self-contained file first
- Put CSS in a
<style>tag and JS in a<script>tag - Load libraries and fonts from absolute
https://URLs (a CDN) - Inline images as data URIs, or use absolute URLs
Exports from Claude, ChatGPT, Jupyter and most test runners already are self-contained.
Your options (checked 22 November 2026)
| Option | What happens | Good for |
|---|---|---|
| Email attachment | Arrives as a file, phones often show code | Never for a live page |
| Google Drive / Dropbox | File preview or download, not a page | Storing the source |
| GitHub Pages | Needs a repo and a push, free on public repos | Long-lived dev sites |
| Netlify Drop | Drag a folder, no-account drops sit behind a temporary password until claimed | Multi-file sites |
| Tiiny Host (free) | Files up to 3 MB, 1 live page | One small page |
| Link in Seconds | One file, one link, rendered in a sandbox, with a QR code and view count | Sharing one page fast |
What works inside a sandboxed page
Hosts that render untrusted HTML safely run it inside a sandboxed frame. Scripts, forms that post to an external service, alerts and pop-ups work. What's withheld is same-origin access: no cookies, no localStorage, no sessionStorage. That restriction is exactly what lets the page be served safely.
Why does my shared page look broken?
Almost always because it points at files that weren't uploaded:
-
Relative paths like
styles.cssor./img/logo.pngonly exist on your machine. Inline them or use https URLs. - file:// links only open on your own computer.
- localStorage or cookies won't persist in a sandbox.
-
Several files? Zip the folder with an
index.htmlat the top and publish it as a static site instead.
Full guide with screenshots and FAQs: https://linkinseconds.com/blog/share-an-html-file-as-a-link
I build Link in Seconds solo. Happy to answer questions about sandboxing untrusted HTML in the comments.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.