0

I want to open externally a local file, using a firefox plugin I managed to open it from the browser. But in electron JS when I click on the "exe", a pop-up to download the file appears. How do I open my file locally ? Example :

<div class="1"><a href="file:///myPathToFile">Press Me</a></div>
<div class="2"><a href="file:///myPathToFile2">Press Me</a></div>

I didn't know how to integrate the shell or child command.

Edit : Tried webPreferences: { webSecurity: false } to enable file:// but didn't work.

Seito Kimbo
  • 139
  • 11
  • 1
    Does this answer your question? [Open external file with Electron](https://stackoverflow.com/questions/30381450/open-external-file-with-electron) – Seblor Aug 29 '20 at 00:31
  • @Seblor All is see in all those guides are JS scripts. I have no idea how to apply them on my links. What I want is to click and open a file. I tried disabling websecurity but didn't work – Seito Kimbo Aug 29 '20 at 00:33
  • Then I'm afraid you cannot open a file with HTML only. – Seblor Aug 29 '20 at 00:34
  • @Seblor I did it in firefox thanks to an extension. How come ? – Seito Kimbo Aug 29 '20 at 00:43
  • What's the wider use-case here? Why do you want to use HTML only? Would you be okay with a solution that involves JavaScript? – Erick Aug 29 '20 at 00:51
  • @Erick I have multiple links, each one of them uses `a href`. – Seito Kimbo Aug 29 '20 at 00:51
  • I get that, but I don't understand why you need to open a hard-coded file path directly from an anchor link. What kind of files are you trying to open, as well? – Erick Aug 29 '20 at 01:02
  • @Erick I'm making a game launcher using ElectronJS to well launch games. So far everything is working when i'm testing with firefox and it plugin. – Seito Kimbo Aug 29 '20 at 01:42
  • @SeitoKimbo Browser extensions are JS based, so not HTML only. – Seblor Aug 29 '20 at 09:44
  • @Seblor. Oright. I just want to be able to launch my executable as I do in firefox using this https://addons.mozilla.org/fr/firefox/addon/local-filesystem-links/ – Seito Kimbo Aug 29 '20 at 14:00

0 Answers0