Skip to main content

Posts

Showing posts from September, 2022

How to open electron app via URLs or browser redirect

Overview The goal of this tutorial is to show you how to open URLs or browser redirects in our electron app  Introduction In this process, we create a custom protocol and set our electron app as the handler for that custom protocol. This process is also known as deep linking process. At the end of this tutorial your app-specific url will look something like this:   your-protocol://path/page?data=value   Prerequisites Basic Electron project setup Let's Get Started First Step, register a custom protocol via the electron app using the code below. Try to keep the protocol not too generic so that it should not interfere with other app's deep link URLs. const {app} = require('electron') if (process.platform === "win32") {   app.setAsDefaultProtocolClient("govdrive", process.execPath, [     path.resolve(process.argv[1]),   ]); } else {   app.setAsDefaultProtocolClient("govdrive"); } Now our app is registered to handle our custom protocol. let'