این صفحه هنوز به فارسی نیست و به انگلیسی نمایش داده می‌شود.

Codex or Claude Code made an index.html: how do I open and preview it?

Quick answer

If the agent ran on your computer, open the file it wrote: open index.html on a Mac, start index.html on Windows, xdg-open index.html on Linux. If the page loads other files, serve its folder with python3 -m http.server. If it ran in the cloud, bring its change down first. To see it on a phone or send it, use a link.

Get a link for my HTML file

Free plan: no credit card, 1 published page.

On this page

You asked Codex or Claude Code for a page, and it says it wrote index.html. Now you want to see it. Where that file is depends on where the agent ran: in a terminal on your computer, in a desktop app, in a worktree, in a cloud task, or on another machine. This guide finds the file, opens it, explains when a double-click isn't enough, and shows how to get the page onto your phone.

Want it on your phone, or in front of someone else? Drop index.html into the upload box at the top of this page. You get a preview link without an account. That preview runs no scripts. Click Keep this page — free, no card and sign up, and the page moves into your account, where its scripts run and you can publish it. Convika hosts one HTML file per page, so first ask the agent to fold style.css and app.js into index.html.

Got the page as code in a chat rather than a file? See how to run HTML code from ChatGPT, Claude, or Gemini. Launching a landing page with a form and your own domain? See how to deploy a landing page from Claude Code.

Find the file the agent wrote

Where the agent ranWhere the file isHow to get it onto your screen
Codex CLI or Claude Code in a terminal on your computerIn the folder you started it in, unless you asked for another placeOpen it there, as in the next section
A Claude Code worktree.claude/worktrees/<name>/ at the repository's root, by defaultOpen the file in that folder, or merge its branch first
A Codex worktree in the ChatGPT desktop appUnder $CODEX_HOME/worktrees, by defaultOpen the file in that folder (the chat header's Open button opens your IDE there), or use Handoff to move the chat to Local
A Claude Code artifactA temporary folder outside your project, unless you named a placeOpen the private claude.ai link Claude Code prints
A cloud task: Claude Code on the web or Codex CloudThe task's own workspace in the cloud, not your computerClaude Code: create a pull request, or run claude --teleport to check out the session's branch. Codex: commit or open a pull request, or run codex apply
Another machine over SSHOn that machineServe it there and forward the port, as in the phone section
A Docker containerInside the containerdocker cp copies files from a container to your computer

If you aren't sure, ask the agent: "Where did you save index.html? Give me the full path." OpenAI's docs give Codex users the same advice: "Ask Codex to report each output path and the checks it ran."

The sources, read on October 25, 2026: OpenAI's file docs, environment docs, worktree docs, and CLI reference; Anthropic's Claude Code docs on worktrees, artifacts, and cloud sessions; and Docker's docker container cp. OpenAI says a cloud task's working files stay in its environment: "Each Cloud task has its own working files." Its CLI reference describes codex apply as "Apply the most recent diff from a Codex cloud chat to your local repository."

Open it from a terminal

Each command opens the file in the app your computer uses for .html files, normally your browser:

  • Mac: open index.html. The open manual page on macOS 26.5.2 says it "opens a file (or a directory or URL), just as if you had double-clicked the file's icon."
  • Windows: start index.html in Command Prompt. Microsoft's start reference says you "can run non-executable files through their file association by typing the name of the file as a command." We didn't test it on Windows.
  • Linux: xdg-open index.html. The xdg-open manual says it "opens a file or URL in the user's preferred application," and that it "is for use inside a desktop session only."

You can also ask the agent to run the command: both Codex and Claude Code run commands on your computer. Opened this way, the page comes from your disk, at an address that starts with file:///.

Preview the page in 4 steps

1. Look at what's beside index.html

Open the folder. If you see style.css, app.js, a .json file, or an assets folder next to index.html, the page needs them.

2. Open the file

Run open index.html, start index.html, or xdg-open index.html from that folder. A page with all its code inside the file works this way.

3. Serve the folder if anything is missing

If the page loads blank, or its buttons do nothing, start a server in the same folder:

python3 -m http.server 8000 --bind 127.0.0.1

Open http://localhost:8000/ in your browser. Press Control-C in the terminal to stop the server.

4. Press every button

Click through the page, then check the browser's console for errors. If something only fails from disk, the next section explains why.

Why a double-click isn't always enough

On October 25, 2026, we built the kind of folder an agent writes: index.html with a style.css, a logo.svg, and an app.js loaded with <script type="module"> that fetches data.json. We opened it from disk, from Python's server (Python 3.14.3 on macOS 26.5.2), and in Convika's HTML viewer:

Opened howstyle.csslogo.svgapp.js (a module)data.json (fetched by app.js)
From disk, Chromium 156LoadedLoadedBlockedNever asked for
From disk, Playwright's Firefox 157 test buildLoadedLoadedBlockedNever asked for
From disk, Playwright's WebKit 27.2 test buildLoadedLoadedBlockedNever asked for
python3 -m http.server, all 3 browsersLoadedLoadedRanLoaded
Convika's HTML viewer, Chromium 156 and WebKit 27.2Listed under the page, not shownListed, not shownListed, not runNot listed, never asked for

Each browser's console blamed the null origin a page from disk has. Chromium's message said access to the script "from origin 'null' has been blocked by CORS policy," and WebKit's said "Origin null is not allowed by Access-Control-Allow-Origin." The page's heading showed, styled. Everything its module script should have drawn stayed blank.

Convika's free HTML viewer reads one file in your browser, so it showed none of the 3 files beside index.html. It named them under the page instead: "style.css, app.js, and logo.svg". It doesn't list data.json, because a script asks for that file, not a tag. Use the viewer once the page is one file, as in Show it to someone else.

So a page whose script is a module, or one that fetches its own files, needs a server. Python's http.server documentation says the server "binds itself to all interfaces" unless you pass --bind, and warns that it "is not recommended for production." How to open an HTML file on a Mac tests more kinds of page, including a built app's assets folder.

The agents' own previews

Where you run the agentShows the page itself?What the docs say, as of October 25, 2026
Claude Code desktop app, local sessionYes, in its Browser pane"In a local session, click an HTML, PDF, or video path in the chat to open it in the Browser pane." Claude can also start a dev server and open it there
Claude Code desktop app, SSH sessionNoClaude "can't open your app in the Browser pane" there; forward the port to your computer
Claude Code in a terminalThrough an artifactAn artifact is "a live, interactive web page that Claude Code publishes from your session to a private URL on claude.ai," on Pro, Max, Team, and Enterprise
ChatGPT desktop app, CodexYes, in its file preview and built-in browser"When HTML previews are available, generated .html and .htm files can also open as interactive previews." The built-in browser opens "the local route, file-backed page, or public page"
Codex CLINoIt "doesn't include a visual file preview or annotation interface"
Codex IDE extensionNo browser"Browser isn't available in Codex CLI or the Codex IDE extension"

The rows come from Anthropic's desktop app docs and artifacts docs, and OpenAI's file docs and browser docs. We didn't run these apps ourselves.

A Claude Code artifact is a view of the page, not always your page as it is. Its docs say the artifact's security policy "blocks every external image and all other external scripts, stylesheets, and fonts," apart from Google Fonts and 5 public CDN hosts, and that "Relative links do not resolve, because nothing is deployed alongside the page." Claude Code inlines the rest, so what you see may differ from your index.html.

See it on your phone

Same Wi-Fi, for checking. Start Python's server without --bind 127.0.0.1, find your computer's local IP address, and open http://<that address>:8000/ on the phone. On our Mac, ipconfig getifaddr en0 printed the Wi-Fi address. A server started with the default bind answered at that address, and one started with --bind 127.0.0.1 didn't. We didn't test from a phone, and a firewall or a guest network can block it.

While it runs, anyone on that network can open every file in the folder. Python's docs say the server serves "the current directory" and everything under it, and "will follow symbolic links," which "makes it possible for files outside of the specified directory to be served." Start it only in the page's own folder, never in your home folder, and stop it when you're done.

Another machine over SSH. Start the server on that machine with --bind 127.0.0.1, then forward its port to your computer. Anthropic's desktop app docs give the command for port 3000 on a host named devbox: ssh -N -L 3000:localhost:3000 devbox. Use 8000 for the server above, and open http://localhost:8000/ on your computer.

Any network, or a phone that isn't yours. Use a link. Drop index.html into the upload box at the top of this page for a preview link that works for 3 minutes, without an account, with scripts and forms off. Keep the page to run its scripts, and publish it to send it.

Show it to someone else

A link opens on any phone or computer. First, make the page one file, because Convika hosts one .html or .htm file per page, up to 2 MB. Ask the agent:

Make index.html self-contained: put style.css in a <style> tag and app.js in a <script> tag,
write the contents of data.json into the script, and use https:// links or data URIs for images.
Don't use type="module" scripts that load local files, or fetch() for local files.

Then choose a route:

  • Upload it yourself. Drop the file into the upload box at the top of this page. Click Keep this page — free, no card and sign up. The page moves into your account, its scripts run in the dashboard preview, and you publish it from the page's screen.
  • Let the agent save it. Convika's MCP server works with Claude Code, Codex, and other MCP clients. In Claude Code, run claude mcp add --transport http convika https://mcp.convika.com, then /mcp to sign in. In Codex, run codex mcp add convika --url https://mcp.convika.com, then codex mcp login convika. Both commands follow each vendor's MCP docs. You need a free Convika account, and the sign-in opens in your browser. Then ask: "Save index.html to Convika as a new page and give me the preview link." The tool saves the HTML as the page's first version and returns a private preview link that works for 1 hour. The page goes live only when you ask the agent to publish it. The tools are made for landing pages: they ask for one complete HTML document with Tailwind CSS v3 from its CDN. The MCP setup in Convika's docs has the steps for each client, and what MCP is explains the connection.

On ChatGPT Plus and Pro, and in Business and Enterprise workspaces, OpenAI's Sites can also build and publish a site from Codex, per OpenAI's Sites help.

Frequently asked questions

How do I preview HTML that Claude Code made?

Open the file it wrote. In the Claude Code desktop app, in a local session, click the HTML file's path in the chat and it opens in the Browser pane. In a terminal, run open index.html on a Mac, start index.html on Windows, or xdg-open index.html on Linux, or ask Claude Code to run it. If the page loads a module script or its own data files, serve the folder with python3 -m http.server 8000 --bind 127.0.0.1 and open http://localhost:8000/.

How do I open a file Codex created?

Look in the folder Codex worked in: the CLI writes to its working directory, and a Codex worktree sits under $CODEX_HOME/worktrees by default. Open the file with your system's open command, or serve its folder with Python. In the ChatGPT desktop app, OpenAI says generated .html files can open as interactive previews when HTML previews are available. The Codex CLI has no visual preview.

Why can't I open index.html from a Codex cloud task?

The file isn't on your computer. OpenAI's docs say "Each Cloud task has its own working files," and that your computer's local files "aren't automatically transferred to it." Commit the change or open a pull request from the task, then pull the branch, or run codex apply to apply the task's latest diff to your local repository. Then open the file locally.

How do I see Claude Code's HTML on my phone?

On the same Wi-Fi, run python3 -m http.server 8000 in the page's folder and open your computer's local IP address on port 8000 on the phone. Anyone on that network can then open the folder's files, so stop the server afterwards. On any other network, upload the file for a preview link or publish it. We didn't test the Wi-Fi route from a phone.

Why does my page work on a local server but not when I double-click it?

From disk, the browser blocks the page from loading its own module scripts and data files. In our October 25 test, Chromium 156 and test builds of Firefox 157 and WebKit 27.2 loaded style.css and an image from the folder, but blocked an app.js loaded with type="module". The same folder ran in all 3 from python3 -m http.server. Ask the agent for one self-contained file, or keep using the server.

How do I share what Codex built?

Send a link, not the folder. Ask Codex to make index.html self-contained, then upload it to a host. On Convika, the upload box gives a preview link without an account, and keeping the page on the Free plan lets you publish it. You can also connect Convika's MCP server to Codex and ask it to save the page. OpenAI's Sites can build and publish a site from Codex on Plus, Pro, Business, and Enterprise.

Is python3 -m http.server safe to use?

For checking your own page on your own computer, yes, with --bind 127.0.0.1, which keeps it to your machine. Python's docs say the server listens on all interfaces by default and is "not recommended for production," and that it follows symbolic links out of the folder. Run it only in the page's folder, and stop it with Control-C when you're done.

Sources

Next step

How to password protect an HTML page without code, on your own domain

JavaScript passwords sit in the page code. Put an HTML page from ChatGPT or Claude behind a server-checked password on your own domain.

Related articles

More ways to send your page

Share this article

Show the page on any phone with a link

Upload the index.html once and publish it. Whoever you send it to opens the page in their browser, on a phone or a computer, with nothing to install.

Get a link for my HTML file

Free plan: no credit card, 1 published page.