Launching the Electron application from a standard web browser

Clicking the mailto: link will open my default email client. Similarly, I would like to run the Electron application with my-app: What is the best way to achieve this and gracefully drop the standard http link if the application is not installed?

In addition, I would also like to receive additional details of my-app:foo/bar . How will it be intercepted inside the Electron when it starts?

I have read several documents on what, in my opinion, may be relevant: http://electron.atom.io/docs/v0.36.0/api/protocol/ however, as a third-party developer, there are some gaps in my understanding about how the comprehensive process works. Any help is much appreciated!

+8
electron
source share
2 answers

Electron has evolved quite a bit since this question was first published.

You no longer need to dive so deep that you can skip the Electron protocol API. Instead, use the app.setAsDefaultProtocolClient(protocol[, path, args]) interface and its siblings app.removeAsDefaultProtocolClient(protocol[, path, args]) and app.isDefaultProtocolClient(protocol[, path, args]) .

They allow you to register the protocol identifier your-protocol:// and get the arguments:

The entire link, including the protocol, will be passed to your application as a parameter. Electronic API Documents

+7
source share

I'm not sure that you can do what you want to do. Depending on whether you want to start the Electron application from a real browser window or just from another instance of Electron.

I found this other link post which shows a workaround (although I'm afraid that it won’t do anything good) and explains how it can be dangerous to run programs directly from the browser.

If you want to start the Electron application from another Electron application, however you can check this link .

0
source share

All Articles