question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handling custom (MyApp://) protocol on MacOS

See original GitHub issue

Electron.NET version: 9.31.2 Target platform: MacOS

I need to handle the login token from the custom protocol (MyApp://) but I am unable to handle the passed arguments to the app. I have successfully registered the application as a protocol hander and it gets launched/opened in the app directly from safari by using : await Electron.App.SetAsDefaultProtocolClientAsync("MyApp"); and setting it in-app plist (As documented).

But I don’t know how to handle the passed URL. I can’t do that by listening to IRC event (as documented in Electron documentation in handling the custom protocol on MacOS): Electron.IpcMain.On("open-url", Handleprotocol()); The app gets opened/resumed when requested in safari but nothing happens. The IPC message is not published.

Is that a bug or am I doing something wrong ? cant seem to find anything similar in samples or around the net specifically for Electron.NET.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
zacbrecommented, Jul 22, 2020

Hey @olirehacek!

At a quick glance, it doesn’t appear that ‘open-file’ or ‘open-url’ is implemented in Electron.NET.

https://github.com/ElectronNET/Electron.NET/search?q=open-file&type=Code

0reactions
rakista112commented, Oct 6, 2020

@DavidNorena for Windows you might need to parse process.argv to get the file. Seems like open-url and open-file only work on macOS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to map a custom protocol to an application on the Mac?
For example, you could use the following bash script as a handler for the "speak://" protocol. #!/usr/bin/env bash # The 'say' command on...
Read more >
macos - How do I configure custom URL handlers on OS X?
I haven't been able to find information on how to set the URL handler for protocols and custom protocols. I'm assuming there is...
Read more >
Build your own custom protocol handler for MacOS | jw bargsten
The dirty way: HammerSpoon and GreaseMonkey (or ViolentMonkey). The approach is simple: HammerSpoon has native support for URL events on MacOS.
Read more >
Custom protocol handler to provide local resources.
I'd like to provide custom pages with extension that allows users to access custom UI for example options page etc. On WebExtensions standard...
Read more >
Register a Custom Protocol URL Scheme for my CustomApp
Need help properly registering my CustomApp in macBook Pro running Mojave. I'm trying to "deep link" the CustomApp so it launches a shell ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found