TODO:
- Open
External Link
from About Window.
Lets add ability to open external link in default browser.
All we need to do is add one module:
require('electron').shell
Also we should add click handler. So when user clicks by link we take href
of this element ( in our particular case - <a>
tag ) and launch shell.openExternal
electron-app/pages/about_page.html
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.shell = require('electron').shell;
</script>
</head>
<body>
<h1>ABOUT PAGE</h1>
<a id='open-external' href="https://github.com/DmytroVasin/">Open</button>
<script type='text/javascript'>
document.getElementById("open-external").addEventListener("click", function (e) {
e.preventDefault();
var remoteLink = this.getAttribute('href');
shell.openExternal( remoteLink );
});
</script>
</body>
</html>
That is all! Now you can launch npm run electron
and check result.