Local HTML and JavaScript

Can I run local HTML and JavaScript on iPhone?

Yes, you can run local HTML and JavaScript on iPhone in a WebKit-based viewer. See what runs, what needs a server, and how to keep pages working offline.

Short answer

Yes. You can run local HTML and JavaScript on iPhone by opening the file in an app that renders it with WebKit, the engine behind Safari. HTML Keep runs client-side JavaScript, including alerts, dialogs, in-page navigation and saved localStorage data. Server-side code such as PHP, Node or Python doesn't run on the phone.

What 'running' a local page really means

An HTML page has two possible halves. Client-side code, the HTML, CSS and JavaScript, runs inside the web engine on your device. Server-side code runs on a remote machine and sends results back.

An iPhone is perfectly able to run the first half. The question is only which app you open the file in.

Why the built-in options fall short

Quick Look in the Files app often shows a static snapshot without running scripts. Safari can run JavaScript, but it has no simple way to open a local file from Files by path.

Developers sometimes install a local web server app, which works but means managing folders and ports. Uploading to a host gets you a URL, but your page leaves the device.

Running a page with HTML Keep

  1. Get the app from the download page.
  2. Share your .html file, or a .zip of the project, to HTML Keep from Files, Mail, AirDrop or a chat app.
  3. The page loads in WebKit and its scripts run immediately.
  4. Interact with it: event handlers, timers, canvas drawing, animations, alert and confirm dialogs, and script-opened pop-up windows all behave as in a browser.
  5. Navigate between pages inside the project with real back-and-forward history.
  6. Close and reopen later. Data the page stored in localStorage is still there.

That makes it a good home for small tools and games; see playing local HTML games on iPhone.

What runs locally and what doesn't

  • Runs: plain JavaScript, popular front-end libraries bundled with the project, canvas and SVG graphics, CSS animations, audio and video files in the project.
  • Runs with internet: scripts or fonts loaded from a CDN, and requests to public web APIs that allow it.
  • Varies: fetch() calls that read local JSON files can be restricted when a page is opened as a local file. Inlining the data in a script tag is the safer pattern.
  • Doesn't run: PHP, Node, Python or any backend, databases on a server, and build steps such as npm scripts. Build the project first and open the output folder.
  • Not included: a developer console or source editor. The app is for running and using pages, not debugging them.

Tips for pages that should work on a phone

If you're making a page to run locally on iPhone, a few habits help.

  • Use relative paths like js/app.js, never /js/app.js or a path from your computer.
  • Bundle the libraries you need into the project if the page must work offline.
  • Add a viewport meta tag so the layout fits the screen.
  • Store state in localStorage so progress survives closing the app.
  • Ship multi-file projects as a ZIP; missing CSS and JavaScript explains why.

When a page creates a file, such as a CSV export, the app passes it to the share sheet so you can save it.

Who gets the most out of local JavaScript

Running pages locally suits people whose pages are finished and self-contained. A teacher can carry an interactive quiz to class without Wi-Fi. A developer can check how a built prototype feels on a real phone before sending it to a client. Someone who asked an AI assistant for a budgeting calculator can keep it on the Home Screen like any other app.

It's a weaker fit if you need to write and debug code on the phone itself, or if the page depends on your own server. In those cases, develop on a computer and bring the finished build over. For pages built by AI tools, viewing AI-generated HTML on your phone has extra tips.

Frequently asked questions

Does JavaScript in HTML Keep behave like Safari?

It uses Apple's WebKit, the same engine as Safari, so client-side scripts generally behave the same way.

Can I run a React or Vue project?

Yes, if you open the built output, the static HTML, JavaScript and CSS files. Source that needs a build step or dev server won't run.

Is there a console to see errors?

No. There are no built-in developer tools, so debug on a computer and open the finished page on your phone.

Can I open a page from a URL instead?

No. It opens local files only and isn't a general web browser.

Android updates

Leave your email and we will notify you when Android testing or Google Play access opens.

We will only use this email for Android availability updates. Privacy