Is there any (simple/built-in way) to open a new browser (I mean default OS browser) window for a link from Electron instead of visiting that link inside your Electron app ?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- Keeping track of variable instances
To run an Electron project in your actual browser (Chrome, Mozilla, etc), add this to your script are external script:
There's a much better and simpler way, than what @Marcelo proposed, yet easier to implement for all links at once to what @zianwar proposed.
NOTE: Requires jQuery.
You can simply use :
To make all Electron links to open externally in the default OS browser you will have to add an
onclick
property to them and change thehref
property so it doesn't load anything in the Electron app.You could use something like this:
But make sure the entire document has loaded before doing this otherwise it is not going to work. A more robust implementation would look like this:
Remember that if you load external files you will have to make them go through this process as well after they are fully loaded.