Convika

Русской версии пока нет — показана английская.

How to open an HTML file in Safari on iPhone, iPad, and Mac

Quick answer

On a Mac, open Safari and choose File > Open File (Command-O), or Control-click the .html file and choose Open With > Safari. On an iPhone or iPad, tapping the file in Files opens a Quick Look preview that ran no JavaScript in our tests: open an HTML viewer in Safari and choose the file there, or send a link.

Get a link for my HTML file

Free plan: no credit card, 1 published page.

On this page

Your .html file opens in TextEdit, in a code editor, or in Chrome on your Mac, or as a preview on your iPhone, and you want it in Safari. This guide covers the Safari part on each device: the menu, the shortcut, the default app, Terminal, and what an iPhone or iPad does instead. For everything else about one device, see the guides for iPhone, iPad, and Mac. For Chrome, see how to open an HTML file in Chrome.

Sending a file you made? The upload box at the top of this page turns it into a preview link without an account. That preview runs no scripts, so a quiz or game won't respond there. 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.

Open an HTML file in Safari on a Mac in 4 steps

These steps come from Apple's help pages, read on November 4, 2026. That day we read the menu labels in Safari 26.5.2's own files and opened a test page with the Terminal command, on macOS 26.5.2. We didn't try the menu, a drag, the Finder's Open With, or Get Info > Change All.

1. Choose File > Open File in Safari

Open Safari and choose File > Open File, or press Command-O, then pick the file. Safari 26.5.2's menu file names the item Open File. Apple's list of Mac keyboard shortcuts describes Command-O as "Open the selected item, or open a dialog to select a file to open."

2. Or drag the file onto Safari

Apple's guide to opening a file with a particular app says: "Drag the file onto the app icon in the Finder or the Dock." Drop the .html file on Safari's icon in the Dock.

3. Or choose Open With > Safari

Apple's steps: "Control-click the file, choose Open With, then choose an app." Pick Safari. On our Mac, macOS listed Safari among the apps that can open an .html file. This opens the file in Safari once. The next double-click still uses the app set for .html files.

4. Make Safari the app for .html files

Apple's steps: select the file, choose File > Get Info, and under Open with, "Click the pop-up menu, choose an app, then click Change All." Choose Safari. Apple adds: "Don't click Change All if you only want the specific file you selected to open with that app."

From then on, a double-click opens every .html file in Safari. On the Mac we tested, .html files were set to open in Google Chrome. Apple's help for making Safari your default web browser is about webpages: in System Settings > Desktop & Dock, choose Safari next to Default web browser. Apple notes that "Some apps open webpages in a browser other than your default browser."

From Terminal

In Terminal, go to the folder with the file and run:

open -a Safari page.html

macOS's manual for open says -a "Specifies the application to use for opening the file", and that file names are read "relative to the shell or Terminal window's current working directory". Without -a, open page.html opens the file "just as if you had double-clicked the file's icon", in the app set for .html files.

We ran the command on November 4, 2026, on macOS 26.5.2, from the folder of a test page with files beside it. Safari 26.5.2 opened the page at a file:/// address. What the page did there:

In the test pageIn Safari 26.5.2, from file:///
A script written inside the fileRan
style.css and photo.png in the same folderLoaded
classic.js in the same folder, loaded with <script src="classic.js">Ran
game.js in the same folder, loaded with <script type="module" src="./game.js">Didn't run
fetch("data.json") for a file in the same folderFailed, with "TypeError: Load failed"
A number saved with localStorage, then the file opened againKept

On an iPhone

Tapping an .html file in the Files app doesn't open Safari. Apple's guide to Files on iPhone says: "If you haven't installed the app that created a file, a preview of the file opens in Quick Look." In our iOS 26.3 Simulator test of October 6, 2026, that preview showed the text and the CSS inside the file, ran no JavaScript, and loaded nothing from the web.

To see the page in Safari, open the free HTML viewer in Safari, tap Choose an .html file, and pick the file. The page runs in Safari, and the file isn't uploaded. If someone sent you a file you weren't expecting, ask them first, and turn off Run scripts before you choose it. The iPhone guide has the steps and what to do with a file from Mail, WhatsApp, or Messages.

Apple also describes Open With: touch and hold the file, "Choose Open With from the menu, then choose an option." We didn't test which apps an iPhone lists there, or what Safari does with a file:// path typed into its address bar.

On an iPad

In our iPadOS 26.5 Simulator test of October 24, 2026, the Files app gave Safari no way in:

  • A tap opened a Quick Look preview. The CSS applied, but the script didn't run and a button counter stayed at 0.
  • Open With said "No Apps Available", with one choice: Preview with Quick Look.
  • Get Info showed the kind as "HTML text", and Always Open With said "No Apps Available".
  • The preview's share button offered Copy, Print, Add Tags, and Save to Files, and its list of apps was empty.

The same file ran in Safari when we chose it in the HTML viewer: the script ran and the counter counted taps. For a file someone sent you that you weren't expecting, ask the sender first, and turn off Run scripts before you choose it. The iPad guide has the steps and the full test. We didn't test a physical iPad, iPadOS 26.7 or 27, or a file:// path typed into Safari.

Why it opens in Safari but looks broken

A page opened from your Mac's disk has a file:/// address, and Safari blocks some of what it loads there. In our test, a module script and a data.json fetch from the page's folder failed, while CSS, images, and plain scripts beside the page loaded. A file that came to you alone, by email or chat, has nothing beside it at all.

To see the error, open Web Inspector from the Develop menu. Apple says its console shows "logs, errors, and warnings emitted from a webpage". If you don't see the Develop menu, Apple says to "choose Safari > Settings, click Advanced, then select 'Show features for web developers.'"

Safari also has a switch for local pages. Apple's developer documentation says that once those features are shown, "Safari adds a Developer pane to its settings", and lists Disable local file restrictions there: "Disable security checks that may prohibit local development when loading content with the file:// protocol." Safari 26.5.2's settings files carry the same label. We didn't turn it on. It changes only your own Safari, not the browser of anyone you send the file to.

The fix that works everywhere: ask the AI that made the page for one HTML file with the CSS, the JavaScript, and any data inside it, or put the page at a web address.

Ways to open it in Safari, compared

Way to open itWhere it worksWhat runsFiles beside itWho sees the page
File > Open File, a drag, or Open With > SafariMacThe page from file:///Module scripts and data files blocked (same file:/// address as our Terminal test; these ways not tried)Only you
open -a Safari page.htmlMac (tested)The page from file:///, scripts inside it includedAs aboveOnly you
Tap the file in FilesiPhone, iPadA Quick Look preview, not Safari: no JavaScript in our iOS 26.3 and iPadOS 26.5 testsNot loadedOnly you
HTML viewer in Safari, Choose an .html fileiPhone, iPad, MacThe page in a walled-off frame, scripts on unless you turn off Run scriptsNot loaded; the viewer lists files named in tagsOnly you
Another browser or a file app from the App StoreiPhone, iPadNot testedNot testedOnly you
A link to a published pageAny phone or computerThe page from https://, in Safari or the default browserOne HTML file goes up, so fold them into the page firstEveryone with the link

A file you send arrives as a file, so the other person goes through the steps above on their own device, and on an iPad, Files gave Safari no way in. A link opens the page from an https:// address in their browser, which on an iPhone, iPad, or Mac is Safari unless they changed it. In our iPad test, a published Convika page opened in Safari with its scripts running.

With Convika:

  1. Drop your 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.
  2. Click Keep this page — free, no card and sign up. The page moves into your account, and its scripts run in the dashboard preview.
  3. Click Publish page. Under Who can open this page?, choose Public and click Next. The first time, click Publish free.
  4. Copy the address under Live URL and paste it into the email or chat instead of the file.

On Free, the page is published as Public: anyone with the link can open it, and it may show up in search results and in Convika's gallery. To keep it out of both, choose Private link (Pro) under Who can open this page? when you publish. Anyone with a private link can still open it.

Convika hosts one HTML file per page, so fold any game.js or style.css into the page first. You can also start from the free HTML publishing tool, which has the same upload box. How to share an HTML file as a link compares other free hosts, and Is it safe to open an HTML file? covers files you weren't expecting.

Frequently asked questions

How do I open an HTML file in Safari on a Mac?

Open Safari, choose File > Open File (Command-O), and pick the file. Or Control-click the file in the Finder, choose Open With, and pick Safari, or drag it onto Safari's icon in the Dock, as Apple's guide describes. The page opens at a file:/// address. In Terminal, open -a Safari page.html does the same; we tested it in Safari 26.5.2.

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

Open an HTML viewer in Safari, such as Convika's free HTML viewer, tap Choose an .html file, and pick the file from Files. The page runs in Safari, and the file isn't uploaded. Tapping the file in Files opens a Quick Look preview instead, which ran no JavaScript in our iOS 26.3 test. For a file you weren't expecting, ask the sender first, and turn off Run scripts before you choose it.

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

The same way: open an HTML viewer in Safari, tap Choose an .html file, and pick the file in the Files sheet. In our iPadOS 26.5 test, the Files app's Open With said "No Apps Available", so it offered no way to send the file to Safari, and its preview ran no JavaScript. The viewer ran the same file's script in Safari.

Can I open a local HTML file in Safari on iPhone?

Not from the Files app in our tests: a tap opened Quick Look, not Safari. We didn't test typing a file:// path into Safari's address bar. A web page that reads the file in Safari, such as an HTML viewer, runs it, and a link to a published page opens in Safari with one tap.

How do I make Safari open HTML files by default on a Mac?

Select an .html file, choose File > Get Info, pick Safari under Open with, and click Change All, as Apple's guide describes. Then a double-click opens every .html file in Safari. Choosing Safari as the Default web browser in System Settings > Desktop & Dock sets the browser for webpages, which Apple's Safari help covers.

How do I open an HTML file in Safari from Terminal?

Go to the file's folder and run open -a Safari page.html. In our test on macOS 26.5.2, it opened the file in Safari 26.5.2 at a file:/// address, and the script inside the page ran. Without -a, open page.html uses the app set for .html files.

Why does my HTML file look broken in Safari?

Because a page opened from your disk can't load everything. In our test, Safari 26.5.2 blocked a game.js module and a data.json fetch from the page's folder, though CSS, images, and plain scripts beside it loaded. A file sent alone has nothing beside it. Web Inspector, in the Develop menu, shows the error in its console. Ask the AI for one self-contained HTML file, or publish the page and open its link.

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 that opens in Safari

Upload the HTML file once and publish it. Whoever you send it to taps the link, and the page opens in Safari, or whatever browser their phone or computer uses, with its scripts running.

Get a link for my HTML file

Free plan: no credit card, 1 published page.