Documentation

Create a portable .htmltoapp project

Choose a single HTML file or a ZIP with local assets. Try both formats, add artwork and deliver a project someone can export on their own Mac.

Package format · JavaScript bridge · Plain-text project guide

Choose the smallest useful package

Give the recipient an editable project document ending in .htmltoapp, not a prebuilt .app. Double-clicking the document opens the converter in HTML to App 1.1.0 or later. It does not run the page, install a Mac app, or add anything to the workspace library. Choose Export with Defaults or Customize, review access, then save the app on your Mac. The resulting export embeds its resources and no longer depends on the document.

Work in the builder or convert from Finder

Lay out the source

For a multi-file tool, keep the lowercase index.html at the ZIP root like this. One enclosing project folder is also accepted. No manifest, build script, signing key or executable is required.

index.html
style.css
app.js
ProjectIcon.png
data/sample.json

Use a real document title, UTF-8 and a viewport declaration. Load local CSS in the head. Use a deferred script or a JavaScript module. Relative URLs such as ./data/sample.json and imports such as ./lib/format.js work without starting an HTTP server. Match filename case. Use actual files or hash navigation, not a server route that rewrites to the entry page. Bundle fonts, images and libraries the tool needs offline. For a framework project, package the output of its static build, not its development server or dependency directory.

Use the following command from inside the example project folder above, with a new output name. It names the files explicitly so local credentials and unrelated files do not get swept into the archive. Adapt the list to the actual project. If your archiver produces a normal .zip, rename it to .htmltoapp without changing the bytes.

zip -X "../My Tool.htmltoapp" index.html style.css app.js ProjectIcon.png data/sample.json
unzip -t "../My Tool.htmltoapp"

Use stored or deflated, unencrypted ZIP entries. Include only regular files and directories with relative names. Do not include symlinks, absolute paths, parent components, conflicting names that differ only by case or Unicode normalization, or nested ZIPs in place of the site. Omit .git, .env files, build caches, credentials and personal data. The importer accepts up to 256 MiB of input, 512 MiB expanded, 4,096 entries, 32 path levels and a 32 MiB HTML entry. These are ceilings, not targets. Keep the entry small and put media in separate files.

Supply editable artwork

For a folder, put a real square PNG named ProjectIcon.png beside index.html. This makes it easy to replace. Without a usable PNG, HTML to App checks <meta name="htmltoapp:icon" ...> in the head, then a supported favicon. Use simple static SVG or PNG. Inline icons are limited to 256 KiB decoded. Separate raster artwork may be up to 8 MiB. Remote or active SVG artwork is not supported.

Both the icon meta tag and <link rel="icon" href="./art/icon.png"> can refer to a project-local file. For a single-file project, inline it instead. PNG is the most portable raster choice. The importer also recognizes JPEG, WebP, GIF, ICO, ICNS, TIFF, BMP, HEIC and AVIF if the system image decoder supports them. The result is static artwork, not an animated GIF. For SVG use paths, shapes, gradients or clip paths with presentation attributes. Avoid CSS styles, text elements, filters, embedded images and external references. A local SVG has the same 256 KiB limit as an inline one. These icon restrictions do not limit SVG drawn inside the project's own web page.

For a single-file tool, include the image in the HTML itself. Encode the hash in an SVG color as %23. The Word Count download shows a complete example.

<meta name="htmltoapp:icon" content="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='29' fill='%23235455'/%3E%3C/svg%3E">

The workspace's Set Project Icon can override the default. When a ZIP needs separate document artwork without modifying the site's own artwork, put ProjectIcon.png and a directory named Website/ side by side, with Website/index.html and its resources inside. In this layout, do not also put an index.html at the package root. Document artwork takes precedence over website artwork. The user can still choose different artwork in the export wizard.

Start a menu bar app without a Dock icon

For a normal windowed app, no extra metadata is needed. For a menu bar utility, add this tag to the entry page's <head>, then export with HTML to App 1.1.1 or later.

<meta name="htmltoapp:dock-visible" content="false">

This chooses the Dock icon's state at launch. It does not create a menu bar item or hide the window. Create the item with HTMLtoApp.menuBar.setIcon() and give its menu Show Window and Quit actions. To change the launch default of an existing app, re-export after editing the tag, even when the site is linked to its original folder.

To let the user change the icon while the app is running, see show or hide the Dock icon. Test this in the exported app. A project can find the system Dock in Preview as well.

Request only what the tool needs

Inside the document head, within the first 768 KiB, use htmltoapp:open-with to suggest export settings. The user reviews them. Metadata does not grant a permission. A tool without file associations or optional permissions needs no tag.

<!-- A text viewer that reads opened documents and saves a separate copy. -->
<meta name="htmltoapp:open-with" content="role=viewer; files=txt,md; folders=false">

Use role=editor only for a tool that intentionally writes back to opened items. Give a comma-separated list of actual extensions, without dots or wildcards. Use folders=true only if the tool handles folders. For a camera tool use camera=true. Other independent options are microphone=true, location=true, listInstalledApps=true and openInstalledApps=true. A launcher that needs both app permissions can use permissions=ListInstalledApps,OpenInstalledApps. User choices, including previously disabling a suggestion, take precedence.

For Finder file registration, files=true alone is not enough. Use files=txt,md or provide a separate extensions=txt,md list. A folder-only viewer can use role=viewer; folders=true without file extensions. A permission-only tag such as permissions=camera does not register any file type.

When updating an older project, the builder also recognizes mic or audio for microphone and geolocation or gps for location. It accepts the legacy meta name htmltoapp-open-with and explicit head comments such as <!-- htmltoapp:open-with: role=viewer; files=txt -->. For a new project, use the meta tag shown above rather than maintaining two declarations.

Keep project files separate from saved data

The project runs in system WebKit on a local origin. It cannot run Node.js, Python, PHP, shell scripts or a local HTTP service. Use relative fetch requests and ES modules for project resources. External services still need connectivity and must allow the request. A custom project origin does not bypass CORS or guarantee every HTTPS-only browser API.

Store preferences in localStorage and structured data in IndexedDB. That data belongs to the app identity and web origin. It is not written into the project or its portable document. Preview and the exported app have separate stores. Provide a real backup/import flow for valuable user records, especially when moving to another Mac. Preserve existing records during schema changes.

On repeat export, Keep Existing Data retains the identity and storage of a recognized replacement. Create a Fresh Copy uses an unused destination and an independent identity. Reset Website Data needs a matching export and an explicit confirmation. The updated app clears its own WebKit data once on launch, not project files or external documents. Replacing an unrecognized bundle via Replace Anyway is not a migration. The new app starts with empty website data. Use a different destination to preserve the old app.

In the workspace choose + > Example Gallery, select an example and choose Create Project. You get editable source, so you can inspect a feature without changing the bundled original.

What you want to buildExamples to open
A widget or a display-edge launcherScreen Ruler for shaped hit regions, Tracing Paper for a floating reference, Edge Shelf for app icons and launch consent, and Cue Cards for presentation across displays.
A menu bar utility or live Dock iconMenu Bar Controls for hiding and showing the Dock icon, Focus Dial for a countdown, Desk Clock for an analog clock, and Notifications and Badge for native alerts and counts. Test the app's own Dock icon after export.
A document or folder toolText Editor for writing back to an opened document, Folder Board for scoped browsing, CSV Cleaner and Subtitle Repair for saving a new copy, and Contact Sheet for processing a folder of images.
A viewer or drawing toolImage Viewer, Audio Player and Video Player open local media. Geometry Pad draws and exports a PNG. Camera Viewer captures stills when camera access is available.
A local data or integration exampleField Guide loads local JSON. Icon Pairs uses sample artwork or installed app icons. Native Integration Demo combines files, menu bar actions, notifications and badges.

Project delivery checklist

  1. Build the working tool the person requested, not a description or a mockup. Start with a useful initial state, a clear primary action and an accessible result. Use real buttons and labels, keyboard focus, readable contrast and layouts that fit a narrow window. Keep system window decorations unless the project really needs a widget.
  2. Use only the native APIs in the bridge reference. A browser has no bridge. Detect each optional feature, explain unavailable actions, and keep ordinary web functions usable. Do not provide invented success responses. Show progress for slow file operations and handle cancellation or denial.
  3. Test with the network off. Check relative fetches, imports, artwork, empty and error states, keyboard access and smaller window sizes. Register native event listeners before reading their initial snapshots. Never ask for privacy access until the relevant user action.
  4. Inspect the delivered archive, not just the source tree. Test its ZIP integrity, extract into a fresh folder, and verify assets and filename case. For plain HTML, test with no neighboring files. Do not include a native launcher, a fake app bundle or any developer credentials.
  5. Deliver the actual .htmltoapp file. State what it does, which permissions are needed and why, where user data lives, and what was actually tested. Give the recipient the converter steps above. Within the workspace use Run and Check Project. Test Finder delivery, Dock artwork, permissions and saved data in the exported app when those behaviors matter. A successful browser test alone does not verify macOS integration.