Created
August 3, 2016 21:47
-
-
Save ahnerd/1dc79f0a5f31ae5200223e3cc589f6fe to your computer and use it in GitHub Desktop.
How to open a link in default browser with electron shell (http://www.techiediaries.com)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shell = require('electron').shell; | |
document.addEventListener('DOMContentLoaded',function(){ | |
var el = document.querySelector('#mylink'); | |
el.addEventListener('click',function(event){ | |
event.preventDefault(); | |
shell.openExternal(this.href); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment