Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for protocol handlers (mailto, etc.) #83

Closed
reedhaffner opened this issue Nov 13, 2021 · 6 comments
Closed

Support for protocol handlers (mailto, etc.) #83

reedhaffner opened this issue Nov 13, 2021 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@reedhaffner
Copy link

I'm running protonmail as a PWA and would really like to be able to register it as a mailto: handler. I can't seem to select the shortcut or the FirefoxPWA.exe for it. I have protonmail registered as the mailto: handler for firefoxPWA.exe.

@reedhaffner reedhaffner added the enhancement New feature or request label Nov 13, 2021
@filips123
Copy link
Owner

This is currently not possible (without manually changing Windows registry to register mailto handler) because FirefoxPWA currently does not register itself to the OS as an available mailto handler. It seems registering custom protocol handlers shouldn't be too hard, so I will probably implement this in the next release.

@filips123 filips123 added this to the 1.5.0 milestone Dec 26, 2021
@filips123 filips123 moved this to To Do in PWAsForFirefox Dec 26, 2021
@filips123 filips123 changed the title Mailto handler? Support for protocol handlers (mailto, etc.) Jan 1, 2022
@filips123
Copy link
Owner

I had to prioritize some other tasks over this in the recent releases, so unfortunately, this is still not implemented, but I hope I will be able to implement it in the next release for real.

The main problem is that there are two ways to register protocol handlers as a website - One is to use existing and already standardized registerProtocolHandler JS API, and the other is to use the proposed protocol_handlers (see also w3c/manifest#846, w3c/manifest#863, w3c/manifest#972) manifest key. Apart from concerns how both APIs should interact and about adding non-standardized API, this also imposes some technical difficulties for implementation.

Despite registerProtocolHandler already being supported in Firefox, it currently cannot work with PWAs due to how it is implemented (website registers itself to Firefox, and Firefox registers itself [not the website!] to the OS; the problem is that with PWAsForFirefox that registration to the OS does not work properly). To properly support registerProtocolHandler API, this registration part to the OS needs to be fixed - It needs to register firefoxpwa executable instead of default firefox, and in the OS settings, it needs to be named after PWA's name instead of just "Firefox". Additionally, both APIs need to be in sync and properly handle PWA updates and uninstalls. On the other hand, supporting just protocol_handlers is easier as it is just a static list, but it is still not standardized and not a lot of websites use it.

I think I know how to do this, but I just wanted to comment about some difficulties in implementing this and to let you know why it is taking so long.

@filips123 filips123 moved this from To Do to In Progress in PWAsForFirefox Jun 22, 2022
@filips123 filips123 moved this from In Progress to Done in PWAsForFirefox Jul 31, 2022
@filips123
Copy link
Owner

I know this took a very long time, but I finally finished it (almost). Protocol handlers will be supported in 2.0.0 which should be released soon.

For privacy and security reasons, protocol handlers are not automatically registered when you install a web app. However, they can be manually enabled/disabled from the extension after the web app has been installed:

extension

Enabled handlers are registered to the operating system and should be able to be called from any other program. Both manifest-based protocol handlers and ones registered dynamically using registerProtocolHandler JS API are supported and behave the same (the only exception is that registerProtocolHandler handlers are enabled automatically after the user confirms them).

The only thing I didn't manage to implement was macOS support because I don't know how to handle URL open requests. I will create a new issue to track this soon.

@demonbane
Copy link

Did this feature end up being removed at some point? I've added a couple of PWAs in Windows using extension version 2.7.3, but I can't find any options like the ones being shown above. I'm just trying to register a PWA as a mailto handler.

@filips123
Copy link
Owner

filips123 commented Aug 19, 2023

TLDR: The feature still exists, but is partially broken due to a bug. This will be fixed.

No, this feature still exists. The "Protocol Handlers" section only exists if there are any available protocol handlers, either registered in the manifest or added through the registerProtocolHandler JS API. If you don't see any protocol handlers there, likely, the website doesn't specify them in the manifest, so you'll need to register them through registerProtocolHandler (most email clients have the option to do this or display the registration bar automatically).

However, the registration through registerProtocolHandler is currently broken due to some changes in recent Firefox versions. I'll try to fix this in the next PWAsForFirefox version. I created #385 about this issue.

If you know the protocol handler URL, you can also try to register it manually by editing config.json inside the user data directory and adding protocol handler details to the custom_protocol_handlers list of your web app:

        "custom_protocol_handlers": [
          {
            "protocol": "mailto",
            "url": "https://example.com?mailto=%s"
          }
        ],

@demonbane
Copy link

I just pulled up the manifest and the handler isn't listed there, so I'm assuming they use the JS api which is affected by #385. I've subscribed to that issue so I'll keep an eye out for fixes. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

3 participants