7

In Electron JS, I created an app for Windows and registered my own protocol for deep linking. The app properly opens when clicking on my link ludo://play?level=1234. No problem there. However I don't know how to retrieve the deep link inside of my app. The docs for app.setAsDefaultProtocolClient mention this sentence:

The whole link, including protocol, will be passed to your application as a parameter.

Can anyone tell me how to retrieve that? Because it is not in process.argv nor is it in process.execPath or process.execArgv.

Could it be passed in a callback when the app starts? Any help on this would be great.

Martin Drapeau
  • 1,484
  • 15
  • 16
  • Take a look at my answer in another SO question: [Pass URL scheme in a Single Instance Electron Application for Windows.](https://stackoverflow.com/questions/38458857/electron-url-scheme-open-url-event/43842895#43842895) – oikonomopo May 08 '17 at 08:30
  • 1
    Anyone did it for ubuntu electon app? i have successfully done it for windows and mac – ninja dev Feb 02 '18 at 05:24

1 Answers1

6

On macOS you need to listen to the app.open-url event, while on Windows the url should be available in process.argv (in the main process).

Vadim Macagon
  • 14,463
  • 2
  • 52
  • 45