How to open file/url in external app #308

Closed
opened 2026-01-29 16:36:12 +00:00 by claunia · 1 comment
Owner

Originally created by @robalexclark on GitHub (May 10, 2019).

Originally assigned to: @GregorBiswanger on GitHub.

I'm trying to open pdfs and external urls in the default browser for both applications (not within the electron app). I researched and found that there might be a way using the electron shell:

const shell = require('electron').shell;
shell.openItem("https://www.google.com");

But the about does not work 'require is not defined' I appreciate I am probably missing something fundamental here! How do you access the electron js functions from your own js files?

Originally created by @robalexclark on GitHub (May 10, 2019). Originally assigned to: @GregorBiswanger on GitHub. I'm trying to open pdfs and external urls in the default browser for both applications (not within the electron app). I researched and found that there might be a way using the electron shell: const shell = require('electron').shell; shell.openItem("https://www.google.com"); But the about does not work 'require is not defined' I appreciate I am probably missing something fundamental here! How do you access the electron js functions from your own js files?
claunia added the question label 2026-01-29 16:36:12 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (May 16, 2019):

You can open external URLs via the Electron.NET API in C#:

Electron.Shell.OpenExternalAsync("https://github.com/ElectronNET");

Have a look at our demo app.

P.S. Running your own TypeScript / JavaScript code will be possible with the next major Electron.NET version.

@GregorBiswanger commented on GitHub (May 16, 2019): You can open external URLs via the Electron.NET API in C#: `Electron.Shell.OpenExternalAsync("https://github.com/ElectronNET");` [Have a look at our demo app.](https://github.com/ElectronNET/electron.net-api-demos) P.S. Running your own TypeScript / JavaScript code will be possible with the next major Electron.NET version.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#308