Reputation: 4828
My electron desktop app loads an angular app into a browser window. That angular app has a button that should open a new website (lets say google.com as an example). When I use the following code...
<button (click)="openNew()">Open a new window</button>
openNew() {
window.open('www.google.com')
}
the app opens a new electron browser window. I want the window to open in a native browser window (chrome, firefox, internet explorer, etc). Can this be possible within an electron app?
Upvotes: 1
Views: 682
Reputation: 1224
Based on documentation, you can open links on OS default browser with code below
const { shell } = require('electron')
shell.openExternal('https://github.com')
Read for further information:
https://www.electronjs.org/docs/api/shell#shellopenexternalurl-options
Upvotes: 1