Documentation

From local web project to Mac app

Convert a local tool straight from Finder, edit it in the workspace, or share its source as a portable .htmltoapp document. If a method is missing from an older export, update the builder and re-export the project. See the Mac release notes. Starting with an idea instead of source files? Follow the vibe coding guide for AI chat.

Share editable projects with friends

Send an editable .htmltoapp project containing your web files and artwork. Your friend needs HTML to App to turn it into a Mac app. They can inspect and change the source, and their own copy of HTML to App supplies the sandboxed launcher.

Try both formats

Word Count is one self-contained HTML file with embedded artwork. Screen Ruler is a ZIP containing the actual gallery project, its PNG, CSS and JavaScript.

To share your own, choose Project > Share Project. If you set a project icon, it travels with the file. The package guide explains how to include artwork and other assets.

Prepare a project for sharing

The complete authoring guide in Markdown covers the package format, supported bridge methods, permission rules, working downloads and a delivery checklist.

Include only the files your project needs. To inspect a document you receive, read a single-file project in a text editor or extract a copy of a ZIP project. Review the JavaScript before running a project you do not know.

What your friend does. With HTML to App installed, they double-click the file to open the converter. That does not run the project. They choose Export with Defaults or Customize, review permissions, and save the app. It opens with the same web content and included icon without needing your original folder. Their saved data and permission choices are their own. Features still depend on their version of WebKit and the access they allow.

Web content and a fixed native runtime

HTML to App is a local web project editor, WebKit preview tool, and app-bundle generator. It is not an environment for downloading, compiling, or testing user-written native executable programs.

Your project stays ordinary web source

Projects consist of ordinary HTML, CSS, JavaScript, and asset files. These files remain accessible, viewable, and editable. The HTML page is the entry point, JavaScript supplies behavior, and CSS supplies styling. Editing these files changes the web content, not the implementation of the native launcher.

The launcher is already built

Every export uses a copy of the fixed, precompiled launcher helper included in the application bundle submitted to Apple for review. This application runtime component automatically loads your project resources in Apple's WKWebView, which renders HTML and CSS and executes JavaScript as web content.

The launcher is not user-generated executable code or an editable native-code project. HTML to App provides no native compilation workflow for rebuilding or changing its implementation.

Export copies files and applies settings

Embedding a project copies its files into the exported bundle's Contents/Resources directory. Project code is not inserted into the native executable or compiled into native machine code. Only project resources, bundle configuration, and the local ad hoc signature are customized. The launcher's native program logic remains unchanged during export.

Original-folder mode references the selected source folder instead of embedding its files. Choose the content mode that fits your workflow.

Packaging is self-contained

The launcher, educational example projects, and optional automation script are supplied inside the application bundle submitted to Apple for review. Packaging does not download remote code or resources. No additional native runtime is downloaded to enable functionality.

Network requests made by your own web project in preview or after launch are separate from packaging. A project that uses online services still needs those services.

Requirements for the builder and exported apps

The builder and the launcher it packages have separate compatibility requirements. The JavaScript features available to your project also depend on the Mac that runs it.

The HTML to App builder

The current builder requires macOS 12 or newer. Export includes an ad hoc signing step that also requires macOS 12 or newer. On macOS 11 or earlier, that step fails before the exported app is saved to your chosen destination.

Which web engine runs my app?

Preview and exported apps use Apple's system WebKit through WKWebView. They do not use Electron or embed Chromium, the browser behind Google Chrome. The launcher targets macOS 12 or newer, but an older system WebKit may lack newer JavaScript syntax or web APIs. Test on the oldest system you support.

When a macOS or Safari update installs a newer system WebKit, your existing app uses it automatically the next time it opens. You do not need to re-export. New HTML to App bridge features are different and can require a new export. See Apple's release notes for WebKit changes.

Create or add a project folder

Open the + menu beside Projects in the main window. Choose the starting point that matches your work, then select the project in the sidebar to see its source files.

New Project

Choose a location for a new folder. HTML to App creates an editable notes app with index.html, style.css, app.js, and a README so you can start changing a working project immediately.

Add Project Folder

Choose an existing website folder with index.html at its root. The workspace uses that folder in place. If you use a build tool, select its generated website folder with the HTML, CSS, JavaScript, and assets needed to run the site.

Example Gallery

Browse educational web projects for drawing, text editing, media playback, and native integration. Each example includes its HTML, CSS, JavaScript, and asset files so you can inspect the implementation. Choose Create Project to save an editable copy in a new folder, then modify it. The source code and instructions are bundled with the app, not downloaded.

HTML is the entry point, not the whole app. The HTML entry page provides the structure. JavaScript powers the app's behavior, and CSS controls its styling and layout. Scripts and styles can be embedded in the entry page or linked as separate files. Folder projects use index.html at the root, alongside the scripts, stylesheets, and assets they need.

Edit, run, and check your work

The main window brings the project list, source editor, and Checks & Output together. Your project settings are kept for later previews and exports.

Edit the original source files

Select a file in the Files list to edit supported UTF-8 text, including HTML, CSS, JavaScript, JSON, and Markdown. Save or Command-S writes to the original project folder. Use Command-F to find text. Use Project's Reload Files command after external changes. Select a PNG or SVG to preview it, replace it with the same file type or reveal it in Finder.

Run a preview

Choose Run to preview your web content directly in Apple's WKWebView. Workspace preview does not launch an exported application. Save your edits and run it again to see the changes. Checks & Output collects JavaScript errors and console messages while you try the project.

Use View for Reload Page, Back, Forward, Home or page zoom. If WebKit repeatedly stops, choose Reload Page to retry. See how web links and new-window requests behave.

Check local resource paths

Check Project inspects the saved entry page and static HTML and CSS references. It reports missing resources, paths outside the project folder, and external URLs. JavaScript-generated paths and application behavior still need testing in the preview and exported app.

Keep control of your folders

Duplicate Project makes a separate copy for a new version or experiment. Remove from List only removes the workspace entry. If a folder becomes unavailable, use Reconnect Folder to restore access. Show in Finder opens the source location.

Move to Trash moves the actual source folder to Finder's Trash and can break a linked export. The Files context menu also lets you copy a relative path, duplicate a file or move it to Trash.

Test native permissions after export

The workspace preview is useful for layout, navigation, local content, and supported bridge features. Mac App Store Preview does not request camera, microphone or location. A Setapp Preview that advertises the corresponding capability can ask with your consent. Test Finder associations, live Dock artwork and the app's own privacy and notification prompts after export. Preview storage and exported app storage are separate.

Export an app for your Mac

Choose Export App for the selected project. To package a web project from its HTML entry page or folder without adding a project, use Convert HTML to App at the top of the main window. In Finder, select one HTML file or one website folder, right-click and choose Services > Convert HTML to App. Export with Defaults skips artwork customization. Both it and Customize let you review requested access.

Choose the content mode

HTML Source and Packaging lets you set the window title and choose how content is loaded. Embed it to include the website inside the app, or use its original location to keep loading from the source folder. If a linked source moves, use Locate Folder or Locate HTML File in the exported app to reconnect it. An imported portable document always embeds its resources.

Set the identity and save the app

Choose the app name and artwork. Customize the label, font, color and outline or set Dock icon effects. Review Finder file handling and permissions. On Ready to Export, choose Save HTML App and a destination for the .app bundle. Then follow the first-launch guidance. Return to the project whenever you want to make another change.

Run the default export on your Mac

HTML to App gives the exported .app a local ad hoc signature for running and testing on your Mac. The export is not notarized or submitted to App Review. Follow the first-launch guidance when opening your trusted export.

Export copies the fixed, precompiled launcher. It does not compile native code, download resources, or run your project's build or install scripts. If the project needs a web build step, package the finished web files.

Share the project with a friend

Select your project and choose Project > Share Project. Review the included files for private content, then send the .htmltoapp document by AirDrop, email, or another file-sharing service. It carries your web files and project icon, not the native launcher or your saved website data.

Your friend needs their own copy of HTML to App. They can inspect and edit the web source, then double-click the document to open the converter, review permissions, and export an app for their Mac. Opening the document does not run the project. See the portable project examples and package guide.

Debug an exported app

Choose Customize if the converter offers export defaults. On Ready to Export, check Enable Developer Mode before saving. It is off by default. If you already exported the app without it, export again with the checkbox selected. Leave it unchecked for a copy without debugging tools.

Open the exported app and choose Developer > Show JavaScript Console. Reproduce the issue there to see console messages, JavaScript errors, and resources that failed to load. Use Find, Copy Log, or Reload Page. This works on macOS 12 or later without Safari.

For breakpoints or network requests on macOS 13.3 or later, leave the exported app running. In Safari's Advanced settings, enable the developer features if the Develop menu is missing. From that menu, select the exported app's page to open Web Inspector.

App Sandbox is retained. Both the workspace and exported apps use macOS App Sandbox. Their access remains constrained by sandbox entitlements and applicable user permissions, not unrestricted system access. Exports include read-only Downloads permission and outgoing network access, alongside their own container and the locations you authorize. Read the permission details and comparison with shell builds and app wrappers.

Decide what happens to saved data

Website storage belongs to the exported app, not the project document. Share Project does not include localStorage, IndexedDB, cookies or the sender's folder permissions.

Keep Existing Data

Replace a recognized export to keep its identity and website data. This is the default. Keeping the same filename alone does not prove it is the same project.

Create a Fresh Copy

Choose an unused destination to create an independent app with empty storage. The original app and its records stay intact.

Reset Website Data

Confirm a reset for a recognized export. Quit and reopen the updated app to clear its WebKit data once. The source folder and external documents are not erased.

If the destination is not recognized, Replace Anyway is a separate confirmation. It replaces the bundle without inheriting the old app's data. For notes or other valuable records, build an explicit backup and import feature.

Open your export on your Mac

Saving an export and allowing it to launch are separate steps. Only proceed with your own export when you trust its JavaScript, HTML pages, stylesheets, and other content.

First launch and manual handling

  1. Separately choose Open App on the export completion screen. macOS opens the copied launcher with your packaged web resources. This is different from workspace preview, which uses WKWebView directly. Use Show in Finder to locate the saved app.
  2. If macOS blocks an unidentified or unnotarized app, use Open Privacy & Security. After trying to open your trusted export, choose Open Anyway if macOS offers it, then confirm Open.
  3. On macOS 12, the corresponding controls are in System Preferences under Security & Privacy. Later versions use System Settings and Privacy & Security.

If the completion screen offers Copy Commands and Open Terminal, review the generated commands for that specific export before choosing to run them. They are a manual local-launch option, not a distribution step.

If macOS reports damage or malicious software, stop and investigate instead of approving it. Consult Apple's guidance on safely opening apps for the warning you see.

Optional automation in the Mac App Store edition

The optional automation script is open source and included in the application bundle submitted to Apple for review. It is not downloaded. Installation requires an explicit user action.

  1. Use View Script to inspect the complete source code before installation. Choose Install Script on the export completion screen only if you want to enable automation.
  2. Keep the exact Application Scripts destination and the name HTMLtoAppApproval shown in the installation dialog.
  3. Installation handles the current export. Once the script is installed and up to date, HTML to App runs it automatically after subsequent exports.
  4. If Update Script is offered, review and install the current version to resume automation. If approval fails or is cancelled, the exported app remains saved. Use Retry Approval or the manual instructions.
  5. To disable automation, use Scripts Folder and remove HTMLtoAppApproval. Manual handling remains available.

The user-installed script runs outside the App Sandbox and removes the com.apple.quarantine attribute only from HTML to App exports for local use. It does not compile native code, change the app's signature, grant privacy permissions, or change system-wide security settings. It does not turn off Gatekeeper across your Mac.

The Setapp edition handles local export preparation with its bundled helper and does not ask you to install this script.

Local approval is not Apple approval

The word "approval" in this workflow refers only to local launch handling on your Mac. The export already has an ad hoc signature. Neither manual launch handling nor the optional script supplies a Developer ID identity, notarization, an Apple malware review, or App Store approval. They do not grant camera, microphone, location, or other privacy permissions. They are not substitutes for Apple's distribution requirements.

HTML to App itself is available on the Mac App Store and Setapp. Those listings concern the builder, not the apps you export.

Design a Mac window, widget or launcher

The JavaScript bridge reference lists the methods, return values, options and events. Use the browser notice example to offer the Mac app when the project opens on the web.

App shortcuts and Dock artwork

Listing installed apps and their icons is separate from permission to request a launch. Launch requests need user input. An exported app with a visible Dock icon can draw live artwork. See installed apps and Dock artwork.

Connect JavaScript to native Mac features

Use this when you want the generated app to behave like an image viewer, video player, audio player, folder browser, or another file-driven tool.

Open With registration

  • Choose whether the app should open files, folders, or both.
  • Set the role to Viewer or Editor.
  • Enter file extensions such as jpg, png, or mp4.
  • Export the app bundle with those document types included in the generated Info.plist.

Runtime delivery

  • When the user opens a matching file from Finder, macOS launches your generated app.
  • The launcher receives the opened file or folder URLs on the native side.
  • HTML to App forwards those items into the page after the web content is ready.
  • Editor-role apps can also write back inside the opened file or folder scope.
  • The same page can also receive later open events while the app is already running.

App permissions

  • Advanced Settings can enable generated-app entitlements for camera, microphone, or location services.
  • The same permissions can be preselected automatically from HTML metadata when the source is chosen.
  • List Installed Apps and Open Installed Apps are separate choices. A metadata suggestion does not authorize launching an app.
  • This is useful for camera viewers, audio capture tools, voice utilities, mapping tools, or mixed-media apps.

Notifications and Dock badge

  • Use the standard Notification API to show native macOS notifications from your JavaScript.
  • Use window.HTMLtoApp.setBadge(value) to set a Dock tile badge string.
  • Use window.HTMLtoApp.clearBadge() when there is no active count or status to show.
  • The bridge namespace is exactly window.HTMLtoApp.

Menu bar apps

  • Create a menu bar icon from JavaScript with window.HTMLtoApp.menuBar.setIcon().
  • Regenerate the menu on every popup with window.HTMLtoApp.menuBar.setMenu(() => items).
  • Use nested submenu arrays for recursive menus and checked plus toggle for stateful items.
  • Enable closeToMenuBarOnWindowClose so closing the window keeps the app alive in the menu bar.

Auto-detect Open With and permissions

Declare the app's file-handling role and requested permissions in the HTML entry page's metadata. HTML to App uses that metadata to prefill the Open With controls and Advanced Settings permission checkboxes when the source is selected.

Recommended meta tag

<meta
  name="htmltoapp:open-with"
  content="role=editor; files=jpg,jpeg,png; folders=true; permissions=camera,microphone"
>

Supported values

  • role=viewer or role=editor
  • files=jpg,jpeg,png selects specific extensions. files=true alone does not register any.
  • folders=true or folders=false
  • permissions=camera,microphone,location for generated-app entitlements
  • camera=true, microphone=true, and location=true are also accepted
  • listInstalledApps=true and openInstalledApps=true independently suggest installed-app access
  • mic, audio, geolocation, and gps are accepted aliases
  • Existing projects may use an explicit head comment. See the metadata examples and accepted forms.

Example app types

  • Image viewer: role=viewer; files=jpg,jpeg,png,webp; folders=true
  • Video player: role=viewer; files=mp4,mov,m4v; folders=true
  • Folder browser: role=viewer; folders=true
  • Drawing app: role=editor; files=jpg,jpeg,png,webp
  • Camera viewer: permissions=camera

JavaScript API

Generated apps expose launch items, runtime capability info, a scoped file bridge for document-style workflows, and native app-state controls for Dock badges, menu bar icons, and window behavior.

Bridge namespaces

  • window.HTMLtoApp: Finder launch items, runtime information, scoped file operations, Dock badge control, menu bar controls, and window controls.
  • Notification lets JavaScript request native macOS notifications through a standard browser-style constructor provided by the generated app.

Initial launch items

Read the initial selection from window.HTMLtoApp.launchItems.

const launchItems = (window.HTMLtoApp && window.HTMLtoApp.launchItems) || [];

Later open events

Listen for htmltoapp-open when the user opens more files or folders while the app is already running.

window.addEventListener("htmltoapp-open", (event) => {
  const detail = event.detail || {};
  const items = detail.items || [];
  const replaceExisting = !!detail.replaceExisting;
  handleLaunchItems(items, replaceExisting);
});

Runtime capabilities

Check whether Open With is enabled, whether the build is a viewer or editor, and whether write-back is available through window.HTMLtoApp.runtime.

const runtime = (window.HTMLtoApp && window.HTMLtoApp.runtime) || {
  enabled: false,
  role: "viewer",
  allowFiles: false,
  allowFolders: false,
  canWriteBack: false
};

window.addEventListener("htmltoapp-runtime", (event) => {
  console.log("runtime", event.detail);
});

Notifications and Dock Badge

Use these APIs for local app status such as completed tasks, reminders, unread counts, queue lengths, or attention states. The generated Mac app requests local notifications. It does not configure APNs or server-delivered remote push notifications.

Send a macOS notification

Call this from a Notify Me button. It checks permission before sending the title and body to macOS. A result of "requested" does not confirm delivery.

async function requestNotice(title, body) {
  if (!("Notification" in window)) return "unavailable";
  const permission = Notification.permission === "default"
    ? await Notification.requestPermission()
    : Notification.permission;
  if (permission !== "granted") return permission;
  new Notification(title, {body});
  return "requested";
}

Set or clear the Dock badge

Badge values are strings. Numbers work well for counts, while short labels can represent states like paused, new, or sync pending. Request notification permission before enabling Dock badge controls, because macOS ties Dock badge visibility to notification authorization for the generated app.

const appBridge = window.HTMLtoApp;

async function setUnreadCount(count) {
  if (!appBridge || typeof appBridge.setBadge !== "function") return;
  if (!("Notification" in window)) return;

  const permission = await Notification.requestPermission();
  if (permission !== "granted") return;

  if (count > 0) {
    appBridge.setBadge(String(count));
  } else {
    appBridge.clearBadge();
  }
}

Behavior notes

  • Notifications are available through the generated app bridge on macOS versions that support native user notifications.
  • If the user denies permission, macOS does not deliver the notification. Preview uses the builder's identity. Test your project's own authorization and Dock badge in an export.
  • Dock badge controls should use the same permission gate as native notifications, so users are not offered badge actions that macOS will keep hidden.
  • Only the title and body reach the native notification. The launcher does not forward tag, icon or silent. Two notifications with the same tag are not grouped or replaced by the bridge.
  • Do not rely on a native notification click reaching JavaScript. Calling close() does not remove a delivered notification, and a JavaScript callback is not a delivery receipt.
  • The Dock badge belongs to the running generated app and is cleared when you call clearBadge() or set an empty value.
  • Guard both APIs when the same web app is also opened in a normal browser.

Launch item shape

Files and folders share a common shape, with a few extra fields depending on item type.

Common fields

  • id: opened-item identifier on root launch items
  • itemId: same identifier, also included on folder listing entries
  • name: display name of the file or folder
  • path: original macOS path as a string
  • relativePath: path inside the opened folder, or an empty string for the root item
  • isDirectory: true for folders, false for files
  • kind: file or directory on root launch items

File and folder extras

  • url: loadable URL for a file item, usable in img, video, audio, or fetch()
  • baseURL: base URL for a folder item
  • listingURL: JSON endpoint for the folder contents

Example folder listing

Pass an item from launchItems. Use result.entries and check result.truncated before describing the list as complete. If the folder is no longer available, handle the rejected promise and ask the user to reopen it. Entries can be passed back into window.HTMLtoApp.fs through entry.itemId plus entry.relativePath.

async function listOpenedFolder(folder) {
  if (!folder?.isDirectory) return {entries: [], truncated: false};
  return window.HTMLtoApp.fs.list(folder);
}

Scoped file bridge

The generated app can read opened content in both viewer and editor mode. Mutating methods are only available when Open With is enabled and the role is Editor.

Read and overwrite the opened file

If the launched item is a file, omit relativePath and write directly back to that same file.

const api = window.HTMLtoApp;
const file = launchItems.find((item) => !item.isDirectory);
if (file) {
  editor.value = (await api.fs.readText(file)).text;
  saveButton.disabled = !(api.runtime.canWriteBack && file.writable);
  saveButton.onclick = async () => {
    try { await api.fs.writeText(file, editor.value); }
    catch (error) { statusLine.textContent = error.message; }
  };
}

Move a draft inside an opened folder

If the launched item is a folder, target descendants by relative path. The bridge never grants access outside that opened folder tree.

// Call from an Archive action for an existing draft.
async function archiveDraft(folder) {
  const api = window.HTMLtoApp;
  if (!api.runtime.canWriteBack || !folder?.writable) return;
  try {
    await api.fs.move(folder, "drafts/today.md", "archive/today.md", {
      createIntermediates: true, overwrite: false
    });
  } catch (error) { statusLine.textContent = error.message; }
}

Available methods

  • stat(itemOrId, relativePath?) returns metadata for a file or folder.
  • list(itemOrId, relativePath?) returns folder metadata plus entries and truncated. If truncated is true, do not describe the listing as complete.
  • readText(itemOrId, relativePath?) returns decoded text plus detected encoding.
  • readData(itemOrId, relativePath?) returns Base64 data plus MIME type.
  • writeText(itemOrId, text, relativePath?, options?) creates or replaces a text file.
  • writeData(itemOrId, base64Data, relativePath?, options?) creates or replaces any file.
  • createDirectory(itemOrId, relativePath, options?) creates a folder inside an opened folder item.
  • remove(itemOrId, relativePath?, options?) removes a file or folder. Use recursive: true for non-empty folders.
  • move(itemOrId, fromRelativePath, toRelativePath, options?) renames or moves items inside an opened folder.

Write options

  • writeText supports encoding, atomic, and createIntermediates.
  • writeData supports atomic and createIntermediates.
  • createDirectory supports createIntermediates.
  • remove supports recursive for non-empty folders.
  • move supports createIntermediates and overwrite.

The text encodings and errors reference lists accepted output encodings and what to offer when a document is unavailable, read-only or too large.

Recommended handling pattern

Use this for native items from startup, later Finder opens or a Dock drop. For a file input or a web drop that returns browser File objects, read those with standard web APIs instead. If a folder listing is truncated, tell the user the results are partial.

const SUPPORTED_EXTENSIONS = new Set(["png", "jpg", "jpeg"]);

function extensionOf(name) {
  const dot = name.lastIndexOf(".");
  return dot === -1 ? "" : name.slice(dot + 1).toLowerCase();
}

function isSupportedFile(item) {
  return !item.isDirectory && SUPPORTED_EXTENSIONS.has(extensionOf(item.name || item.path || ""));
}

async function expandLaunchItems(items) {
  const results = [];
  let truncated = false;

  for (const item of items) {
    if (!item) continue;

    if (isSupportedFile(item)) {
      results.push(item);
      continue;
    }

    if (item.isDirectory && window.HTMLtoApp && window.HTMLtoApp.fs) {
      const listing = await window.HTMLtoApp.fs.list(item.id);
      const entries = Array.isArray(listing.entries) ? listing.entries : [];
      results.push(...entries.filter(isSupportedFile));
      if (listing.truncated) truncated = true;
    }
  }

  return {files: results, truncated};
}

Important behavior notes

The Open With role and file registration are scoped on purpose. They can support real editor workflows without turning the app into an unrestricted filesystem client.

Viewer vs editor

  • Viewer and Editor control how the app is registered with Finder and Launch Services.
  • Viewer keeps the bridge read-only.
  • Editor enables window.HTMLtoApp.fs write methods for the opened item scope only.
  • Use Viewer for galleries, players, and browsers.
  • Use Editor when the app should overwrite the opened file or manage files inside the opened folder.

Project source vs opened content

  • HTML to App still exposes loadable item URLs for media tags, image previews, and fetch().
  • Folder items can be expanded through window.HTMLtoApp.fs.list() or the provided listing URL.
  • When you export in external-source mode, the selected project source folder remains read-only.
  • Opened document files and folders are a separate scope, and editor-role apps can modify only that specific opened file or folder tree.

Examples and support

Use the gallery index by feature to find an example for your project. Create a copy in the workspace before editing it.

Web project examples on GitHub

Browse editable examples for HTML to App, including editors, media players, and native integration demos. Explore the JavaScript behavior, CSS styling, and HTML entry pages, then adapt a project for your own Mac.

Browse example source on GitHub

Need help wiring your app?

Use GitHub Issues for bug reports, feature requests, and public troubleshooting. Include your expected file types and how the app should react when content is opened. Keep private files and secrets out of public reports.

See all support options