electron: setAsDefaultProtocolClient for protocol tel:// does not work at Windows 10
- Electron Version: v2.0.5
- Operating System (Platform and Version): Windows 10
- Last known working Electron version:
Expected Behavior On calling url with protocol “tel://” electron application must appeare at dialog window with appropriate applications wich can handle tel protocol.
Actual behavior On calling url with protocol “tel://” Electron application does not appeare at list of applications wich can handle tel protocol.
To Reproduce
- Include
app.setAsDefaultProtocolClient(Protocol);at main.js; - Package application for Windows;
- Install application from step 2 (will be run automatically after installing);
- Call any “tel://” url (for example from Win+R execute command “tel://1234”);
$ git clone https://github.com/GeorgeTsaplin/FinesseConnector -b master
$ npm install
$ yarn install
$ yarn dist
Additional Information
Possible solution will be change SetAsDefaultProtocolClient implementation at browser_win.cc: for Windows 10 must be set such registry keys:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Classes\callto]
@="URL:callto"
"URL Protocol"=""
[HKEY_CURRENT_USER\SOFTWARE\Classes\tel]
@="URL:tel"
"URL Protocol"=""
[HKEY_CURRENT_USER\SOFTWARE\Classes\{Electron application name}.callto]
[HKEY_CURRENT_USER\SOFTWARE\Classes\{Electron application name}.callto\DefaultIcon]
@="{path to electron application exe file}"
[HKEY_CURRENT_USER\SOFTWARE\Classes\{Electron application name}.callto\shell]
[HKEY_CURRENT_USER\SOFTWARE\Classes\{Electron application name}.callto\shell\open]
[HKEY_CURRENT_USER\SOFTWARE\Classes\{Electron application name}.callto\shell\open\command]
@="\"{path to electron application exe file}" %1"
[HKEY_CURRENT_USER\SOFTWARE\{Electron application name}]
[HKEY_CURRENT_USER\SOFTWARE\{Electron application name}\Capabilities]
"ApplicationDescription"="{Electron application description}"
"ApplicationName"="{Electron application name}"
[HKEY_CURRENT_USER\SOFTWARE\{Electron application name}\Capabilities\URLAssociations]
"callto"="{Electron application name}.callto"
"tel"="{Electron application name}.callto"
[HKEY_CURRENT_USER\SOFTWARE\RegisteredApplications]
"{Electron application name}"="Software\\{Electron application name}\\Capabilities"
Also must be changed IsDefaultProtocolClient and RemoveAsDefaultProtocolClient
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 10
- Comments: 18 (1 by maintainers)
As a workaround, anyone wanting to register the tel protocol can use this snippet:
The registration is per user, so you need to execute this code for every user. You can execute it at every launch of your app, it won’t do any harm. This won’t prevent you from building on Linux or macOS, rage-edit uses the
regcommand, and a such is not a native dependency.Found this when searching for a solution to https://github.com/electron/electron/issues/22565 - The best are workarounds which require admin privileges for your application (not even sure how well they work in windows 7,8,10 let alone 11). Do the Electron SDK devs anticipate this will ever be fixed? If so, do we have ETA please?
This issue has been present for a while, I do not think it will be solved in a near future since Windows uses a hash to validate the protocol association (at least it has been reverse engineered, link).
You can check the registry entry for the association here:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\tel\UserChoiceTo have a similar experience as
setAsDefaultProtocolClientyou could include a flow like: 1 - Register the app using this workaround. Alternatively, you can use electron-builder and a custom NSIS. 2 - Remove the current protocol association:3 - Make the association modal appear with:
You can tweak the flow checking if your app is currently the protocol handler:
Please do not forget to remove your entries from the Windows Registry when your app is being uninstalled.
Hi, I’m using electron 15.0.0 with Windows 10. The method seems not work. I tried with “tel”, “callto” and with a custom protocol but it works only with my custom protocol. The app is not registered for the protocol I specify, so when I call the url, the app won’t be opened. Also app can’t be registered as default app manually, so the problem is that the method doesn’t register the app for handling protocol.
My code is very simple:
Is there some log I can activate in order to investigate it? Should I manually write the keys into register?
Thank you for your issue!
We haven’t gotten a response to our questions in our comment above. With only the information that is currently in the issue, we don’t have enough information to take action. I’m going to close this but don’t hesitate to reach out if you have or find the answers we need, we’ll be happy to reopen the issue.