Can I "redirect" URLs so they open in my Electron app?


#1

I know I can use the protocols feature to register a handler for a custom schema (e.g. myapp://something/else), but can I use this feature to intercept specific domain URLs?

On my mobile I can click on a Facebook link in my emails (that starts with http:// facebook …) and have it open up in the Facebook app. I’d like to have http ://example.com/myapp/something/else (but not example .com, or example .com/someotherapp). Can Electron do something like this?

My specific use case is this: I’m writing an Electron app that uses the GitLab API. When a repo issue is updated, I get an email from GitLab. There’s a “View this in GitLab” link at the bottom, but clicking it obviously takes me to GitLab in my default browser. I’d like to intercept the link click for a specific URL (e.g. http ://gitlab/myapp/something) and then have my Electron app take me to the GitLab issue specified in the URL.

Is this possible? I’m not overly concerned about cross-platform, as we’re just running this on Windows machines.


#2

I am looking for something smiliar too. This could be cool


#3

@Grayda did you find a solution to your question?


#4

This isn’t something that is within Electron’s power. Your browser interprets URLs and decides what to do with them. In order for Electron to catch a URL, your browser would have to know that it needs to try to open an external program like with a magnet link, and in order to do that, you would probably have to develop a browser extension to change the content of the page to turn the link into a magnet link.