Electron-builder: How is custom protocol link passed to the app?

Created on 27 Oct 2016  路  1Comment  路  Source: electron-userland/electron-builder

  • Version: 7.14.2

  • Target: mac osx

Hi, I built a custom electron app, installed it on Mac OS X. It is registering custom protocol fine, and even opens the app when I try to open using open todo://whatever (the custom protocol example is todo). The application opens but the url todo://whatever is NOT passed as process argument. I am printing the arguments and all I see is process args /Applications/todo.app/Contents/MacOS/todo

My build config is as follows

"build": {
    "appId": "",
    "mac": {
      "category": ""
    },
    "protocols": [{
      "name": "todo",
      "role": "Viewer",
      "schemes": ["todo", "todos"]
    }]
  }
question

Most helpful comment

OSX doesn't pass them as arguments, unlike every other OS (that'd be too easy). You need to register an open-url event handler on your app object and parse them there. Build config looks good, so it should work once the event handler is set up.

>All comments

OSX doesn't pass them as arguments, unlike every other OS (that'd be too easy). You need to register an open-url event handler on your app object and parse them there. Build config looks good, so it should work once the event handler is set up.

Was this page helpful?
0 / 5 - 0 ratings