Skip to content

Handle files

Published

The file_handlers manifest member associates file types with an installed PWA, so a desktop user can open a .csv file by double-clicking it or choosing the app under “Open with”. The browser reads the association when the PWA is installed, and page JavaScript reads the file through window.launchQueue. An in-app file picker provides the same import on Android, Firefox, and Safari.

You need an installable PWA (see Getting started), Chrome or Edge 102 or later on Windows, macOS, Linux, or ChromeOS, and a file type to own.

Each entry in file_handlers needs an action URL inside the app’s navigation scope and an accept map from MIME type to file extensions (MDN marks both as required). Chrome also reads an optional icons array, which lets the OS show a file-type icon instead of the app icon, and launch_type:

{
"file_handlers": [
{
"action": "/open",
"accept": { "text/csv": [".csv"] },
"icons": [
{ "src": "/icons/csv-file.png", "sizes": "256x256", "type": "image/png" }
],
"launch_type": "single-client"
}
]
}

launch_type defaults to "single-client": opening several matching files at once produces one launch whose LaunchParams.files holds every file. With "multiple-clients" Chrome launches the app once per file and each launch’s files array has one element. Reinstall the PWA after changing this member; the OS association is written at install time, and Chrome resets the file-handling permission whenever file_handlers changes.

  • Legend
  • Yes
  • Partial
  • Flag
  • No
  • Unknown
Browser / PlatformSupportVersionsConfidenceSourceNotes
Chrome (Desktop)#Yes102highsource—
Chrome (Android)#No—highsource1
Edge (Desktop)#Yes102highsource2
Firefox (Desktop)#No—highsource3
Firefox (Android)#No—highsource45
Safari (macOS)#No—highsource6
Safari (iOS)#No—highsource78
Samsung Internet#No—highsource910
WebView (Android)#No—highsource1112
  1. No Chrome Android support is recorded in browser-compat-data.
  2. Derived by browser-compat-data mirroring from Chrome.
  3. No Firefox support is recorded in browser-compat-data.
  4. No Firefox for Android support is recorded in browser-compat-data.
  5. Derived by browser-compat-data mirroring from Firefox.
  6. No Safari support is recorded in browser-compat-data.
  7. No Safari on iOS support is recorded in browser-compat-data.
  8. Derived by browser-compat-data mirroring from Safari.
  9. No Samsung Internet support is recorded in browser-compat-data.
  10. Derived by browser-compat-data mirroring from Chrome Android.
  11. No WebView Android support is recorded in browser-compat-data.
  12. Derived by browser-compat-data mirroring from Chrome Android.

Source data: /compatibility/manifest-file-handlers.json · Global usage: 39 % (StatCounter 2026-09, CC BY-SA 4.0)

Source: spec · MDN · Last verified 2026-10-03 · Confidence: high (computed from sources)

Chrome’s capability article states that File Handling is “limited to desktop operating systems”, so the handler does nothing on Android even though the manifest is accepted there.

When the OS opens a file with the app, Chrome navigates to action and enqueues a LaunchParams object on window.launchQueue; Chrome’s launch-handler documentation describes the queue as holding launches “until they are handled by the specified consumer”, so a consumer registered after the page has booted still receives the launch. Register it once, at top level, before any async startup work:

window.launchQueue.setConsumer(async (launchParams) => {
if (!launchParams.files || launchParams.files.length === 0) return;
for (const handle of launchParams.files) {
const file = await handle.getFile();
renderCsv(file.name, await file.text());
}
});

Each entry in files is a file handle rather than a File, which is why the consumer calls getFile() before reading.

Chrome’s article gives the detection as 'launchQueue' in window && 'files' in LaunchParams.prototype; the second half matters because a browser could ship launchQueue for launch_handler navigation without the files member. When the check fails, show a standard file input so the feature still exists, without OS integration:

function supportsFileHandling() {
return 'launchQueue' in window && 'files' in LaunchParams.prototype;
}
const picker = document.querySelector('#open-file-input'); // <input type="file" accept=".csv">
if (supportsFileHandling()) {
window.launchQueue.setConsumer(async (launchParams) => {
for (const handle of launchParams.files ?? []) {
const file = await handle.getFile();
renderCsv(file.name, await file.text());
}
});
} else {
picker.hidden = false;
picker.addEventListener('change', async () => {
const [file] = picker.files;
if (file) renderCsv(file.name, await file.text());
});
}

Keep the picker reachable on desktop too: a user who has not installed the app, or who opens the app first and then wants a file, has no OS launch to rely on.

Install the PWA, then open a .csv from the OS file manager. The first launch shows Chrome’s permission prompt before the app can read the file; grant it and the consumer runs with one entry in files.