How do I open an HTML file on a Mac, and why does my AI-made page break?

Quick answer

Double-click an .html file and your Mac opens it in your default browser from a file:// address. In our October 24, 2026 test on macOS 26.5.2, Chrome 155 ran the scripts inside the file but blocked a game.js module and a data.json file beside it, as did Firefox and WebKit test builds. Use one file, or a web address.

Get a link for my HTML file

Free plan: no credit card, 1 published page.

On this page

ChatGPT or Claude made you a game, a quiz, or a small tool. It worked in the chat. You saved the file, double-clicked it on your Mac, and got a blank page, or buttons that do nothing. This guide shows how to open the file, which parts a browser blocks when a page comes from your disk, and 3 fixes: one file, a local server, or a link.

How to open an HTML file on a Mac

Apple's Mac User Guide lists 4 ways to open a file with a particular app:

  • Drag the file onto the app's icon in the Finder or the Dock.
  • Select the file in the Finder, choose File > Open With, then choose an app.
  • Control-click the file, choose Open With, then choose an app.
  • Open the app, then choose File > Open.

Double-clicking opens the file in the app your Mac uses for .html files. On the Mac we tested, that was Google Chrome. To see or change yours, select the file, choose File > Get Info, and look under Open with. Apple's guide says to pick an app there and click Change All to use it for every file of that type.

However you open it, the page comes from your disk. We opened a test page in Chrome with macOS's open -a command, which hands a file to the app you name, and its address started with file:/// followed by the folder path, not https://. That address is why some parts of a page stop working, as the next section shows.

Quick Look is a preview, not a browser. Apple's guide says to select a file and press the Space bar for a Quick Look window. We opened Quick Look on 2 test files from Terminal with qlmanage -p, macOS's Quick Look command-line tool, rather than with the Space bar. It showed the text and the CSS, but ran no JavaScript: a line the script should have rewritten stayed as it was. Tailwind from a CDN didn't style the page either.

What breaks when the page opens from file://

We built 8 small test pages and opened each from disk on October 24, 2026, between 07:56 and 08:07 JST (22:56 and 23:07 UTC on October 23), on a Mac with macOS 26.5.2:

  • Chrome 155.0.8059.85, the version installed on that Mac, with a fresh profile. We also ran 7 of the pages in Chrome for Testing 156.0.8078.4, with the same results.
  • Firefox 157.0, Playwright's test build. Firefox wasn't installed. Playwright turns off a Firefox setting for local files, so we set it back to Firefox's own default.
  • WebKit 27.2, Playwright's test build. This isn't Safari. We didn't test Safari: controlling it needs a Safari setting that was off, and we didn't change it.
Test page, opened from diskChrome 155Firefox 157 (test build)WebKit 27.2 (test build)Same page from a local server
A script written inside the file (a click counter)RanRanRanRan in all 3
Tailwind from cdn.tailwindcss.comLoaded and styled the pageLoaded and styled the pageLoaded and styled the pageLoaded in all 3
A <script type="module"> inside the file that imports three.js from a CDNRanRanRanNot tested
game.js in the same folder, loaded with <script src="game.js">RanRanRanRan in all 3
game.js in the same folder, loaded with <script type="module" src="./game.js">BlockedBlockedBlockedRan in all 3
fetch("data.json") for a file in the same folderBlockedBlockedBlockedRan in all 3
A score saved with localStorage, then the page reloadedKeptKeptKeptKept in all 3
A built app whose index.html loads /assets/index.js as a moduleBlockedBlockedBlockedRan in all 3, with the server started in the app's folder

So the scripts inside the file ran, and so did scripts from the web, even as modules. What failed was the page reaching for another file in its folder: a module script, a data file, or a built app's assets folder. A game whose code sits in a module file shows its HTML and nothing else, and one that loads its levels from a .json file gets no levels.

Each browser said why in its console. Chrome 155's message for the module:

Access to script at 'file:///…/game.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: … http, https, isolated-app.

Firefox's test build said "Cross-Origin Request Blocked … (Reason: CORS request not http)", and WebKit's said "Origin null is not allowed by Access-Control-Allow-Origin." To see the message in Chrome, press Cmd + Option + J, the Console shortcut in Chrome's DevTools documentation.

MDN, Mozilla's reference for web developers, explains it: "Many browsers, including Firefox and Chrome, now treat all local files as having opaque origins (by default). As a result, loading a local file with included local resources will now result in CORS errors." Its guide to JavaScript modules says the same of file:// pages: "You need to do your testing through a server."

Safari has a switch for this. Apple's developer documentation lists Disable local file restrictions among Safari's Developer settings: "Disable security checks that may prohibit local development when loading content with the file:// protocol." Those settings appear after you select Show features for web developers in Safari > Settings > Advanced. We didn't test Safari or that setting, and it doesn't help the person you send the file to.

A test page we downloaded in Chrome 155 carried macOS's quarantine flag, com.apple.quarantine (we checked with xattr -l). Opened from disk in Chrome, its script still ran. We didn't test opening a downloaded file from the Finder, or files saved from Safari or Mail.

Fix 1: ask the AI for one self-contained file

Every test page that kept its code inside the file, or loaded it from the web, worked from disk in all 3 browsers. Ask the AI that made it:

Give me the whole page as one HTML file: the CSS in a <style> tag, the JavaScript in <script> tags, and any data written into the script. Don't use other files, type="module" scripts that load local files, or fetch() for local files. Use full https:// links for images.

Scripts from a CDN can stay. In our test, Tailwind and three.js loaded from the web into a page opened from disk. A score saved with localStorage was still there after a reload, but only in that browser on that Mac.

Fix 2: run a local server (for developers)

If you'd rather keep the files as they are, serve the folder from your Mac. In Terminal, go to the folder that holds index.html and run:

python3 -m http.server 8000 --bind 127.0.0.1

Then open http://localhost:8000/ in your browser. Every test page that broke from disk ran this way in all 3 browsers. For the built app, we started the server in the app's own folder, because its /assets/ path starts at the top of the server. Press Control-C in Terminal to stop the server.

We ran it with the python3 that came with Xcode on our Mac (Python 3.9.6). We didn't test a Mac without Xcode or Apple's command line tools. --bind 127.0.0.1 keeps the server to your own Mac: Python's documentation says that by default "the server binds itself to all interfaces." It also says "http.server is not recommended for production. It only implements basic security checks." So use it for checking your own page, not for sharing it.

Fix 3: open it from a web address

You can also run the page in a browser tab without a server. Go to the free HTML viewer, click Choose an .html file, and pick the file, or choose Paste code, paste the code from the chat, and click Show the page. Your browser reads the file, and it doesn't reach Convika's servers. The page's scripts run in a frame walled off from convika.com. The viewer opens one .html or .htm file up to 2 MB. Files the page points to with tags, such as game.js in a <script src>, can't show, and the viewer lists them under the page. A file that a script fetches isn't listed.

We pasted 7 of the test pages into a local copy of the viewer on October 24, 2026, in Chrome 155. The scripts inside the file, Tailwind, and three.js ran. The viewer listed game.js under both pages that load it, and neither ran it. The data.json fetch failed. Reading localStorage threw a SecurityError, because the walled-off frame gets no storage, so a game that saves scores can stop at that line. Open a page like that from disk, or publish it.

To get an address other people can open, publish it. The upload box at the top of this page is the first step.

Fix a page that breaks when you double-click it, in 4 steps

1. Check whether the page is one file

Open the folder the page is in. If you see .js, .css, or .json files, or an assets folder, next to the .html file, the page needs them. Sending or uploading only the .html file leaves them behind.

2. Ask the AI for one self-contained file

Paste the request from Fix 1 into the chat that made the page. Save the answer as a new .html file.

3. Open it and press every button

Double-click the new file. Try the buttons, the keys, and the score. In Chrome, Cmd + Option + J shows any error in the Console.

Drop the file into the upload box at the top of this page, or paste the code. You get a preview link in seconds, without an account. It works for 3 minutes, with scripts and forms off. Click Keep this page — free, no card and sign up. The page moves into your account, and its scripts run in the dashboard preview. Then publish it, as the next section shows.

Sending it to someone else

A file you send arrives as a file. On another computer, it opens from that computer's disk, and any game.js or data.json beside it stays behind on your Mac. On an iPhone, tapping an .html file in Files opened a Quick Look preview that ran no JavaScript in our iOS 26.3 Simulator test.

A link avoids both. To publish the page you kept on Convika:

  1. In the dashboard, click Publish page.
  2. Under Who can open this page?, choose Public and click Next.
  3. The first time you publish, Convika shows an order for Pro monthly, which takes the Convika bar off your pages (1 day free with a card, then $12 a month). To publish on Free, click Publish free (with the Convika bar) under its button.
  4. Copy the address under Live URL and send it instead of the file.

The published page opens over https:// at its own address, where scripts inside the page and scripts from a CDN run. Convika hosts one HTML file per page, so fold any game.js or data.json into the page first, as in Fix 1. The Free plan includes 10,000 page views a month; Pricing says what happens past them. How to share an HTML file as a link compares other free hosts, and Publish a ChatGPT HTML game covers games: keys, touch, sound, and saved high scores.

Frequently asked questions

How do I open an HTML file on a Mac?

Double-click it, and it opens in the app your Mac uses for .html files; on our test Mac, that was Chrome. Apple's guide also lists File > Open With in the Finder, Control-click > Open With, and dragging the file onto a browser's icon in the Dock. To change which app opens .html files, choose File > Get Info, pick an app under Open with, and click Change All.

Why is my HTML file blank in Chrome?

The parts that come from other files in its folder didn't load. In our test, Chrome 155 blocked a script file loaded with type="module" and a fetch() of a .json file beside the page, and a built app's /assets/index.js didn't load either. Press Cmd + Option + J to see the error. Ask the AI for one self-contained file, or run a local server.

Why does my HTML game not work when I open it?

If its code sits in a module file like game.js, or its levels load from a .json file, the browser blocked them when the page came from disk. In our test, that happened in Chrome 155 and in test builds of Firefox 157 and WebKit 27.2. The same files ran from a local server. A game written inside one .html file ran in all 3.

Can Safari run HTML files from my desktop?

We didn't test Safari. Playwright's WebKit 27.2 test build, which isn't Safari, ran scripts written inside the file and blocked a module file and a fetch() of data.json from the same folder. Apple's developer documentation lists a Safari setting, Disable local file restrictions, for local development with file:// pages. We didn't test it.

How do I open HTML from ChatGPT on my Mac?

Copy the code from the chat, paste it into a plain-text file, and save it with a name that ends in .html. Double-click the file. If the page needs other files, ask ChatGPT for the whole page as one HTML file first. You can also paste the code into the HTML viewer and click Show the page, with no file to save.

Does Chrome block local HTML files?

Not the page itself. In our test, Chrome 155 ran scripts written inside the file, loaded Tailwind and three.js from the web, loaded a plain <script src="game.js"> from the same folder, and kept localStorage after a reload. It blocked a module script from the same folder and a fetch() of a file there, with a "blocked by CORS policy" error.

How do I share an HTML file so it works for others?

Send a link, not the file. Put the page on a host that serves it over https://, then send the address. On Convika, drop the file into the upload box at the top of this page, keep the page on the Free plan, and publish it. Fold any separate .js or .json files into the page first, because only the one .html file goes up.

Why does my HTML page work in one browser but not another?

In our test, Chrome 155 and test builds of Firefox and WebKit blocked the same things by default. A setting changed that: Playwright's Firefox build turns off a Firefox setting for local files, and with it off, our module and data.json pages worked. With Firefox's default, they were blocked. Safari has Disable local file restrictions among its Developer settings. A page served from a web address doesn't depend on these settings.

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

Send a link instead of the file

Upload the HTML file once and publish it. The person you send it to clicks the link and the page runs in their browser, buttons and all.

Get a link for my HTML file

Free plan: no credit card, 1 published page.