I made an application in electron and packaged it with electron-build for windows. application is registered with myapp://params/ custom protocol. There is a button on my frontend to open that application. What I want is, when user clicks on a button open the application if it is installed otherwise download exe. How can I achieve this? Thank you in advance.
Asked
Active
Viewed 1,501 times
1 Answers
1
'otherwise download exe. ' regarding this please see this post
if you are registered custom protocol for your app and it works fine means you can use <a href="Your protocol with params">
or window.open("your protocol with params")
or window.location='your protocol with params'
read more from electron docs
please see the example below (opening vscode)
<a href="vscode://"> open vscode</a>

Anirudh santhosh
- 451
- 4
- 10
-
Thank you, I'm able to register and open the application by calling custom protocol. my main concern is for download exe. and still, I'm unable to find the perfect solution for this. – Javed Saifi Feb 02 '22 at 05:47
-
1one thing comes into my mind is to open a new tab showing download button and the same page will try to navigate the user to the custom protocol if the app is not installed it should fail and the user will able to see download button but the downside is even he navigated to the app installed in the system the tab will remain opened. and you might want to check different browsers before implementing this regarding their behavior on invalid protocol – Anirudh santhosh Feb 02 '22 at 08:19
-
1@Anirudhsantosh, Yeah, I already did it the same way. I actually was looking for some other way. But thank you for the help buddy. – Javed Saifi Feb 07 '22 at 05:10