A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

File extension association

AshleyScirra
2017-11-09

We make Construct 3, a large desktop PWA at editor.construct.net. It works great, especially when you do “Add to desktop” in Chrome - it looks and feels a lot like a native desktop app.

However one problem our users run in to is file extension association. Construct 3 saves user’s data to a .c3p file. Users are very familiar with double-clicking a file to open it, but double-clicking a .c3p file does nothing. This can leave them with the impression it’s broken. We support loading via drag-and-drop, but not everyone thinks of that.

As far as I’m aware, it’s simply impossible to set up this file association. We need a way to set up a file extension association to meet user expectation and reach parity with our old native desktop app.

It would be great if we could do something like navigator.registerFileExtension(".c3p", "https://myapp.com/url/to/load/file"). Obviously this would need a permission prompt at a minimum. Then the browser would create the OS file extension association. Ideally we could specify an icon too.

Double-clicking a .c3p file could then go through a process like this:

  • Launch the browser
  • Navigate to the registered URL
  • Provide the File object in a variable, e.g. navigator.fileToOpen. The web app can look for this variable when it loads and open it automatically if it is found. This is much like the existing drag-and-drop API but simply making a file available on startup.

Now the user can double-click a .c3p file and have it open in our web app. Could a feature like this be specced?

matthewp
2017-11-09

Would this make sense to go in the web app manifest? It seems closely related to the goals of that.

AshleyScirra
2017-11-10

Yeah, that seems like a reasonable place to put this.

DanielHerr
2017-11-10

This would be a useful feature, but without a writable files api users will still need to manually hassle with exporting.

AshleyScirra
2017-11-10

We use the a@download attribute to download user content to .c3p files. This alone has been enough to highlight the file extension association problem.

marcosc
2017-11-10

Move here: https://github.com/w3c/manifest/issues/626